Free Online JSON Escape and Unescape

Escape raw text into a JSON string, or unescape one JSON string back to text. Escape includes the surrounding double quotes. The text stays in your browser.

Text input

Escaped output

What JSON String Escaping Does

JSON string escaping makes quotes, backslashes, and line breaks safe inside a JSON string. You can escape JSON online or unescape JSON online on this page. The result is a JSON string escape, not URL encoding and not HTML encoding.

Escape reads the input as raw text. If you paste an already escaped string and choose Escape again, the quotes and backslashes are escaped a second time. Use Unescape to reverse one level.

How to Escape and Unescape JSON

Step 1: Paste text

Paste raw text to escape, or one quoted JSON string to unescape.

Step 2: Choose an action

Choose Escape or Unescape. The status line reports success or the problem.

Step 3: Read the output

Escaped output includes the surrounding double quotes. Unescape removes them.

Step 4: Copy or clear

Copy output takes the full result. Clear empties both boxes.

JSON Escape Examples

Quotes and backslashes

say "hi"
"say \"hi\""

a\b
"a\\b"

Escaping the result again

The second Escape treats the first result as raw text, so the quotes and backslashes are escaped again:

"say \"hi\""
"\"say \\\"hi\\\"\""

Line breaks and Unicode

A newline becomes \n and a tab becomes \t. Characters such as 東京 and emoji stay as themselves. The line separators U+2028 and U+2029 are written as \u2028 and \u2029.

Invalid Escape Sequences

Unescape accepts one JSON string, including the surrounding double quotes. Whitespace around that string is allowed. Text after the closing quote is rejected.

\x41, \a, a short \u12, and an unpaired \uD800 are rejected. An object, array, number, boolean, or null is rejected. The output box is cleared when conversion stops.

Frequently Asked Questions

Does this tool upload my text?

No. Escape, unescape, and copy all run in your browser.

Do the results include quotation marks?

Escape adds the surrounding double quotes. Unescape requires those quotes and returns the text inside them.

Where can I format the JSON first?

Use the JSON Beautifier to format a document, the JSON Viewer to inspect a tree, or the JSON to CSV and JSON to YAML tools when you need another format.