Skip to content
JSON Escape
Input
Enter raw text with "quotes" and newlines…
1 lines · 0 chars
Output
1 lines · 0 chars
Awaiting input

JSON Escape & Unescape

Escape and unescape JSON strings without breakage — free, private and running entirely in your browser

JSON Escape writes the inside of one JSON string, or reads that inside back out. Escape is selected on open. Output follows Input after about 80 milliseconds. Clear empties the input. Download saves escaped.txt, or unescaped.txt in Unescape. There is no indent control and no pane swap.

Last updated: 11 October 2026

Guide, examples, and FAQ

About JSON Escape

What it does

Escape calls JSON.stringify on the whole input and drops the quote at each end. " becomes \", a backslash becomes two, and line break, tab, carriage return, backspace, and form feed become \n, \t, \r, \b, and \f. Other controls become \u and four hex digits. é and emoji are unchanged, with no \u option. Unescape strips one leading quote and one trailing quote when present, wraps the rest, and JSON.parse-s it. "hello" returns hello. \u0041 returns A. \uD83D\uDE00 returns the grinning emoji. hello stays hello.

Who it is for

For people putting a sentence, a Windows path, or a log line into a JSON string, and for people turning an escaped value back into characters.

When to use it

Escape before text goes inside a JSON string. Unescape when you already hold that escaped spelling.

Key features

  • Escape the string contents

    JSON.stringify runs on the whole input, then the wrapping quotes come off.

  • Unescape those contents

    One leading quote and one trailing quote come off when present. Single quotes stay.

  • Count and download

    Empty input shows Awaiting input. The download name follows the mode.

How to use JSON Escape

  1. 1Stay on Escape, or switch to Unescape. A full reload does not keep the mode.
  2. 2Paste into Input and wait for the short pause.
  3. 3Read the status: a character count, Awaiting input, or an error.
  4. 4Copy the output, or download escaped.txt or unescaped.txt.

Example

Before

Say "hi"
next\tab	

After

Say \"hi\"\nnext\\tab\t

Say "hi", a line break, next\tab, then a tab: 18 JavaScript characters in, 23 out, status 23 chars. Unescape returns that input. a, U+0001, b becomes a\u0001b (8 characters).

Benefits

  • A quote can sit in the value

    She said "hi" pasted raw into a JSON string ends the value early. Escape writes She said \"hi\", which stays one string.

  • A Windows path keeps every slash

    C:\Users\Ada\notes.txt is 22 characters and escapes to C:\\Users\\Ada\\notes.txt, 25 characters. Pasted raw, \U is not a JSON escape, so the string fails.

Common use cases

  • A multi-line JSON field

    Meet at 9. plus a line break plus She said "bring the file". is 37 characters and escapes to Meet at 9.\nShe said \"bring the file\"., 40 characters. {"note":"Meet at 9.\nShe said \"bring the file\"."} parses back to that note.

Tips & best practices

  • café, a space, and a grinning emoji pass through unchanged, and the status reads 7 chars. That emoji is two JavaScript characters.

Common mistakes to avoid

  • Pasting {"name":"Ada"} and expecting an indented file. Escape writes {\"name\":\"Ada\"}, 18 characters. Braces stay and quotes gain backslashes. Use the JSON Formatter for the document.
  • Escaping twice. a"b becomes a\"b (4 characters), then a\\\"b (6 characters). One Unescape returns a\"b. Unescape again for a"b.
  • Unescape fails only because of a real line break or tab. The status shows: Unescape cannot read a real line break or tab. Use \n and \t instead.
  • Expecting é or an emoji to become a \u code. Escape copies those characters through.

Frequently asked questions

Does this page format, validate, minify, or repair JSON?

It escapes one string. Quotes inside a pasted document gain backslashes. Indenting that document is the JSON Formatter.

Which characters does Escape change?

Quotes, backslashes, and controls. é and emoji are left as they are.

What does Unescape accept?

JSON string escapes, including a surrogate pair. \x41 fails with Bad escaped character in JSON at position 2 (line 1 column 3). Single-quoted 'hello' comes back still quoted.

What do the Unescape errors mean?

A lone backslash shows Unterminated string in JSON at position 3 (line 1 column 4). a"b shows Unexpected non-whitespace character after JSON at position 3 (line 1 column 4). The column counts quotes this page adds. Empty input shows Awaiting input.

Why does the status say chars?

It is the JavaScript length of the output, not a UTF-8 byte count. The greeting reads 23 chars.

Is the text sent anywhere?

No. Both modes run in the page. Memory keeps only the input for the session, under json-escape. The mode is not stored. A reload clears the text.

When do the URL Encoder and Base64 fit better?

The URL Encoder percent-encodes. %20 stays %20 here. Base64, including a file, is the Base64 Encoder. This page never writes Base64.

When another tool fits better

  • JSON Formatter. You need a whole JSON document indented or minified. This page would escape the quotes inside it.
  • URL Encoder. The text belongs in a query string or a URL path, which wants percent-encoding.
  • Base64 Encoder. You need a Base64 spelling of text or a file.

Conclusion

JSON Escape is the page for one JSON string value. JSON.stringify writes the escapes, and Unescape reads them back.

Ready to try JSON Escape?

Scroll back up to start now, or continue with another free developer tool.

Guides and glossary

Learn and reference material connected to JSON Escape.