String Escape / Unescape

Escape or unescape special characters in strings. Supports backslash sequences and JSON string format.

Raw String0 chars
Escaped Output

Common Escape Sequences

\nNewline
\tTab
\rCarriage return
\\Backslash
\"Double quote
\'Single quote
\0Null
\bBackspace
\fForm feed
\uXXXXUnicode (hex)
\xXXLatin-1 (hex)

How to Escape and Unescape Strings Online

  1. 1. Select Escape to convert raw text to an escaped string, or Unescape to reverse it.
  2. 2. Toggle JSON Mode to wrap the output in double quotes and use JSON-compatible escaping.
  3. 3. Paste or type your input — results update in real time.
  4. 4. Click Swap to flip the result, or Copy to copy the output.

Frequently Asked Questions

What characters need to be escaped in strings?

Common characters that need escaping include newlines (\n), tabs (\t), backslashes (\\), double quotes (\"), and null bytes (\0). In JSON strings, all control characters and double quotes must be escaped.

What is the difference between string escaping and JSON escaping?

Standard string escaping converts special characters to backslash sequences. JSON escaping additionally wraps the result in double quotes and follows the JSON specification, which requires escaping forward slashes and all control characters.

When do I need to escape strings?

String escaping is needed when embedding strings in source code, JSON data, configuration files, or any context where special characters have syntactic meaning. It prevents parsing errors and injection vulnerabilities.

Is my data sent to a server?

No. All escaping and unescaping runs entirely in your browser using JavaScript. Your text is never uploaded or stored anywhere.