UTILS.
Private by default
"

JSON String Escaper

Escape or unescape a string for safe use inside a JSON document.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →
output

About this tool

Escape a raw string for JSON or turn an escaped string back into plain text, all in your browser.

Escape runs your text through JSON.stringify and removes the surrounding quotes, so the result can sit inside a JSON string. Double quotes and backslashes get a backslash, line breaks and tabs become \n and \t, and other control characters become JSON escapes such as \u0001. Accented letters and emoji are left as they are.

Unescape accepts the text with or without its outer quotes and decodes it as a JSON string, so escapes such as \n, \", \/ and \uXXXX are understood. A bare double quote or a raw line break inside the text is rejected with "not a valid JSON string".

Frequently asked questions

How does escaping work?
The text is run through JSON.stringify and the surrounding quotes are stripped, giving a JSON-safe string body.
What if unescaping fails?
Invalid escape sequences show an error message instead of producing broken output.
Why does unescape reject my text?
JSON strings cannot contain a bare double quote, a lone backslash or a literal line break. Check that every inner quote has a backslash in front of it and that line breaks are written as \n.

More tools