String Escaper
Escape or unescape \n, \t, \", \\ and Unicode sequences for JSON or code string literals.
Raw text
paste or type · or drop a .txt file
Escaped text
65 chars
No data sent to servers · JSON / JavaScript string escaping rules
Escape sequences this tool handles
Standard JSON and JavaScript string escapes, both directions.
\n \r \tNewline, carriage return, tab
\b \fBackspace, form feed
\" \' \\Quote, single quote, backslash
\uXXXX4-digit Unicode code unit, including surrogate pairs for emoji and other astral characters
Why escape a string
Control characters, quotes, and backslashes cannot appear literally inside a JSON or JavaScript string literal — they have to be escaped or the surrounding code fails to parse.
This matters when embedding user text, file contents, or multi-line strings into JSON payloads, source code, or config files by hand.
The "Escape non-ASCII" option
Off by default: accented and non-Latin characters are left as-is, since both JSON and JavaScript accept raw UTF-8 in strings. Turn it on to force every character above the ASCII range into a \uXXXX sequence — useful for older systems or contexts that require pure-ASCII output.