JSON Escape / Unescape

Escape special characters in strings for safe embedding inside JSON, or unescape JSON-encoded strings back to readable text — live in your browser.

Runs locally
Raw string 0 chars
Escaped

What is JSON string escaping?

JSON strings must be wrapped in double quotes and cannot contain certain characters literally. A raw double quote would close the string prematurely; a literal newline makes the JSON syntactically invalid. Escaping replaces those characters with backslash sequences: " becomes \", a real newline becomes \n, a tab becomes \t, a backslash becomes \\. This tool is the fastest way to prepare a literal string for pasting into a JSON value, or to decode an escaped string back to readable form.

How to use this tool

  1. 1 Choose Escape to prepare a raw string for use inside a JSON value, or Unescape to decode an already-escaped string.
  2. 2 Paste your text — the output updates instantly as you type.
  3. 3 The escaped output is safe to paste directly between double quotes in any JSON document.
  4. 4 Use Swap to copy the output back to input, then switch modes to verify the round-trip.

Frequently asked questions

Should the output include the surrounding double quotes?

This tool outputs just the escaped content without surrounding quotes, so you can paste it cleanly between whichever quote style your target context uses. Add the outer double quotes yourself when building the full JSON string.

What characters get escaped?

Backslash \\ becomes \\\\, double quote " becomes \\", newline becomes \\n, carriage return becomes \\r, tab becomes \\t, form feed becomes \\f, backspace becomes \\b. Control characters (U+0000 to U+001F) that do not have a named escape become \\uXXXX.

Is this the same as JSON.stringify?

The escaping logic is equivalent, but JSON.stringify wraps the result in double quotes and handles full JavaScript values (arrays, objects, numbers, null). This tool escapes only the string content — useful when you have a raw string value and need just its escaped representation to paste into an existing JSON document.

Why does unescaping fail with an error?

The input contains a backslash sequence that is not valid in JSON — for example \p or a lone backslash at the end. JSON only recognizes \" \\ \/ \b \f \n \r \t and \uXXXX. Fix the invalid sequence and try again.

Is my data sent to a server?

No. Escaping and unescaping run entirely in your browser using string replacement and the native JSON parser. Nothing is uploaded.