JSON Escape / Unescape

Escape any text into a valid JSON string, or unescape a JSON string back to raw text. Runs in your browser; nothing is uploaded.

100% free, no sign-up Runs in your browser — nothing uploaded Instant, works offline

A JSON string value can't contain a raw double-quote, a raw backslash, or a literal newline, so those characters must be written as escape sequences: a quote becomes \", a backslash becomes \\, a newline becomes \n, a tab becomes \t, and other control characters become \uXXXX. You need this whenever you embed a block of text — an HTML snippet, a SQL query, another JSON document, or a log line — inside a JSON field, because a single stray quote or line break would otherwise make the document invalid. Press Escape to convert your text into a valid JSON string, or Unescape to reverse it and recover the original characters. Everything runs in your browser and nothing you type is uploaded.

Frequently Asked Questions

What does escaping a JSON string do?

Escaping converts a piece of raw text into a form that is legal inside a JSON string value. A JSON string cannot contain a raw double-quote, a raw backslash, or a literal line break, so escaping replaces each of those with a safe two-character sequence: a double-quote becomes \", a backslash becomes \\, a newline becomes \n, a tab becomes \t, and other control characters become a \u followed by four hex digits. The result is a single line of text that a JSON parser will read back as the exact characters you started with. This tool escapes whatever you type so you can drop it straight into a JSON document without breaking it.

When do I need to escape JSON?

You need to escape text any time it has to live inside a JSON string value. The most common cases are embedding a block of content — an HTML snippet, a SQL query, a log line, or an error message — inside a JSON field; storing a multi-line string, since JSON strings cannot span raw line breaks; and nesting one JSON document inside another as a string, where every quote and backslash of the inner document must be escaped. Escaping by hand is error-prone because a single missed backslash or quote makes the whole document invalid, so pasting the text here and letting the tool escape it saves time and avoids silent syntax errors.

What does the 'Wrap in quotes' option do?

With the box ticked, the output is a complete quoted JSON string literal — the escaped characters plus the surrounding double-quotes — so you can paste it directly as a value into a JSON document. With the box unticked, you get just the escaped inner characters without the surrounding quotes, which is handy when you already have the quotes in place and only need the contents escaped, or when you are inserting the text into a template. Both forms use the same escaping rules; the only difference is whether the two outer quote characters are included. Unescaping accepts input either way, so you never have to match the option to your input.

How do I unescape a JSON string?

Paste the escaped string into the input — with or without its surrounding double-quotes — and click Unescape. The tool parses the JSON escape sequences and turns them back into the characters they represent: \n becomes a real newline, \t becomes a tab, \" becomes a double-quote, \\ becomes a single backslash, and \uXXXX becomes the matching Unicode character. If the input contains a malformed escape, such as a lone backslash or an incomplete \u sequence, it is not a valid JSON string and the tool reports an error instead of guessing. Fix the escape and try again to recover the original text exactly.

Is my data private or uploaded?

No, nothing is uploaded. All escaping and unescaping happens locally in your browser using built-in JavaScript — the text you type and the JSON you paste never leave your device, are never sent to a server, and are never logged or stored. There is no account, no sign-up, and no tracking of the values you convert, so it is safe to use for configuration snippets, log lines, or data you would rather not paste into a random website. Because the work is entirely local, the tool also keeps working offline once the page has finished loading.