String Escape & Unescape
Escape text for a string literal in JavaScript, Java, C#, Python, Go, SQL, CSV, or a regular expression, and unescape it back.
Local workspace
Named projects in IndexedDB · Local only — never synced to our servers. Worksp…
Batch workspace
Format multiple files locally in one run.
Options
| Option | Description |
|---|---|
| Language | Each language escapes a different set of characters and rejects different escapes when decoding. |
| Mode | Escape prepares text for a string literal. Unescape turns a literal's contents back into text. |
| Wrap in quotes | Adds the surrounding double quotes, so the output is a complete literal ready to paste into code. |
FAQ
Which characters get escaped?
Backslashes and double quotes always, plus tabs and line breaks as \t and \n. Control characters become \xNN or \uNNNN depending on the language, and JavaScript and C# also escape U+2028 and U+2029, which end a line in their source files.
Why is my single quote left alone?
The output targets double-quoted literals, where an apostrophe is ordinary text. Escaping it would still work in most languages but makes the string harder to read.
What's different about Go?
In Go, \xNN is a raw byte rather than a code point, so unescaping collects those bytes and decodes them as UTF-8, and reports an error if the sequence is incomplete. Go also requires exactly three digits in an octal escape.
How does CSV escaping work?
It follows RFC 4180: a field is wrapped in double quotes when it contains a comma, a quote, a line break, or edge whitespace, and inner quotes are doubled. Fields that need none of that are left untouched.
Why does unescaping reject something like \q?
Because the language does. Java, C#, and Go treat an unknown escape as an error, JavaScript drops the backslash and keeps the letter, and Python keeps both characters. Unescape follows whichever language you pick.