Escape and unescape strings for JSON, JavaScript, and Unicode instantly
Quick Reference
\nNewline (LF)\rCarriage return (CR)\tHorizontal tab\"Double quote\'Single quote (JS)\\Backslash\bBackspace\fForm feed\uXXXXUnicode code pointString Escape and Unescape converts raw text into safely escaped sequences for JSON, JavaScript, or Unicode — and back again. Handle double quotes, single quotes, backslashes, newlines, tabs, and full \uXXXX Unicode code points with one click. Ideal for debugging API payloads, writing config files, or sanitizing strings before embedding them in code.
JSON only permits double-quoted strings, so it escapes double quotes and common control characters (\n, \t, \r, etc.) plus \uXXXX unicode. JavaScript goes further: it also escapes single quotes, backticks, null bytes (\0), hex sequences (\xNN), and octal literals — useful when building JS string literals or template literals.
Every special character is replaced by a multi-character escape sequence — for example a single newline (1 char) becomes \n (2 chars). The output character count shown after conversion reflects this expected growth.
When checked, only characters with a code point above 127 (accented letters, symbols, emoji surrogates) are replaced with \uXXXX sequences. Plain ASCII letters, digits, and punctuation are left as-is, keeping the output readable. Uncheck it to encode every single character.
Yes. Use the Swap button to move the escaped output back to the input, then switch direction to unescape. The tool reconstructs the exact original string, including all control characters and special symbols.