JSON Escape / Unescape

Paste raw text to get a JSON string literal, or switch modes to unescape one.

Your text and files never leave your browser — nothing is sent to a server.

How to use

  1. Paste the raw text — multi-line messages, file paths, HTML snippets and so on.
  2. In Escape mode, quotes, backslashes, tabs, line breaks and other control characters are written as JSON escape sequences.
  3. Turn off “Wrap in double quotes” if you are pasting into an existing string. Turn on “Escape non-ASCII” for systems that only accept plain ASCII.
  4. Switch to Unescape to turn a JSON string back into readable text. The surrounding quotes are optional.

FAQ

Which characters have to be escaped in JSON?

Inside a JSON string you must escape the double quote, the backslash and control characters below U+0020 such as line breaks and tabs. Everything else, including emoji, may appear as is.

Is this the same as JSON.stringify?

Escaping uses JSON.stringify on the text, so the output matches what JavaScript produces for a string value. Unescaping uses JSON.parse.

Why does unescaping fail?

Usually because a quote or backslash inside the string is not escaped, or because of an escape that JSON does not support, such as \x41 or \'. JSON only allows \" \\ \/ \b \f \n \r \t and \uXXXX.

Related tools

All tools