Encode & Decode · Runs in your browser

JSON Escape

Escape text so it can be placed inside a JSON string: quotes, backslashes, line breaks, tabs and control characters are converted to escape sequences.

Text
Drop a file to load it
Escaped
Waiting for input

How to use it

  1. Paste the text — a message, an HTML snippet, a file path or a whole JSON document.
  2. Optionally wrap the result in quotes, or escape every non-ASCII character as \uXXXX.
  3. Copy the escaped string and paste it between the quotes of a JSON value.

What is escaped

" becomes \", \ becomes \\, line breaks become \n, tabs \t, and other control characters \u0000–\u001F. Everything else is valid inside a JSON string as-is.

Non-ASCII

Accents and emoji are allowed in JSON. Escape them only if the receiving system can’t handle UTF-8; emoji become surrogate pairs like \ud83d\ude80.

Embedding JSON in JSON

To put a whole JSON document inside a string, JSON Stringify gives the same result plus the surrounding quotes, and can minify first.