JSON Escape / Unescape

Make any text safe to put inside a JSON string, and back again.

Runs in your browser
Text or escaped string
Drop file to load it
EmptySaved locally
Result
Ready
More options (1)
Try an example:

How to use the JSON Escape / Unescape

  1. Paste text to escape, or an escaped string to read.
  2. The direction is detected automatically, or choose it yourself.
  3. Optionally add surrounding quotes or escape every non-ASCII character.
  4. Copy the result.

Examples

About this tool

Inside a JSON string, some characters cannot appear as they are. Double quotes would end the string early, backslashes start escape sequences, and line breaks and tabs must be written as \n and \t. Pasting a message, an SQL query or a file path straight into JSON therefore breaks it. Escaping converts the text into a form that sits safely between the quotes.

The reverse is just as common: logs, API responses and configuration files often show strings full of \n, \" and \u codes that are hard to read. Unescaping turns them back into the original text with real line breaks and characters, and if an escape is invalid you are told which one.

The ASCII option writes every accented letter, symbol and emoji as a \u code. The JSON stays valid either way, but this helps with old systems and files that mishandle UTF-8. The two invisible line-separator characters that break JavaScript are always escaped.

This tool runs entirely in your browser. What you type or open is never sent to a server.

Frequently asked questions

Which characters need escaping in JSON?

Double quotes, backslashes and control characters such as line breaks, tabs and carriage returns. Everything else, including accented letters and emoji, is allowed as it is in UTF-8 JSON.

Do I need to escape forward slashes?

No. \/ is allowed but optional. Some tools escape it to make embedding JSON in HTML script tags safer; this tool leaves slashes alone.

How do I put a line break in a JSON string?

Write it as \n. Paste your multi-line text here and every line break is converted for you.

Is my text kept or sent anywhere?

No. Escaping and unescaping happen in your browser and nothing is uploaded.