BYTETOOLS

How to Escape and Unescape JSON Strings (Step by Step)

To escape a JSON string, choose Escape mode, paste your text, and the tool encodes every character JSON forbids inside a string — quotes, backslashes, tabs, and line breaks — so it can sit safely between double quotes. Unescape reverses it, and Stringify wraps the result in quotes to give you a complete JSON value.

This tutorial explains each of the three modes, walks through the steps, and shows why running on your browser's native JSON engine keeps the output correct and your data private.

What escaping actually does

JSON strings live between double quotes, so any double quote, backslash, or control character inside the text must be written as an escape sequence. A quote becomes \", a backslash becomes \\, a newline becomes \n, and a tab becomes \t. Without escaping, those raw characters would end the string early or produce invalid JSON that a parser rejects. Escaping rewrites them into the safe two-character sequences JSON understands.

Step-by-step: the three modes

  1. Choose a mode. Escape encodes the inner content of a string. Unescape decodes it back to raw text. Stringify escapes and also adds the surrounding quotes.
  2. Paste your input. For Escape and Stringify, paste plain text — even multi-line code. For Unescape, paste an already-escaped value like Line 1\nLine 2.
  3. Read the result. The converted output appears below instantly. Escape gives you inner content with no wrapping quotes; Stringify gives a full "..." value.
  4. Copy it. Drop the output into your JSON document, code, or config exactly where you need it.

Escape vs. Unescape vs. Stringify

ModeInputOutputUse when
EscapeHe said "hi"He said \"hi\"Inserting into an existing string
StringifyHe said "hi""He said \"hi\""Building a complete value
Unescapea\nba then b on new linesExtracting the original text

Why the native engine and local processing matter

The tool uses the browser's built-in JSON engine, which is the same strict implementation your runtime uses. That means the escaping is exactly what a compliant parser expects — no guesswork, no partial handling of \uXXXX sequences. Just as importantly, all of it runs on your device: nothing is uploaded, logged, or stored. You can escape payloads containing tokens, secrets, or customer text without any of it leaving the browser, and the tool keeps working offline once the page has loaded.

A quick worked example

Say you want to store this message in a JSON field: She said "go" and left. See log. In Escape mode it becomes She said \"go\" and left.\nSee log. — the quotes are encoded and the line break turns into \n, ready to paste between existing quotes. Switch the same input to Stringify and you get "She said \"go\" and left.\nSee log.", a complete value you can drop straight into an array or assign to a key. Feed that Stringify output into Unescape and you are back to the original readable message, which is the fastest way to confirm your escaping is correct.

Try the JSON Escape / Unescape tool — free and 100% in your browser.

FAQ

Do I use Escape or Stringify to embed code in a JSON field?

Use Escape if you are pasting into an existing pair of quotes in your JSON document. Use Stringify if you want the complete quoted value, including the surrounding double quotes, as a standalone piece.

How do I turn an escaped log line back into readable text?

Choose Unescape and paste the escaped value. The tool decodes \n, \t, and \uXXXX back into real line breaks, tabs, and characters, restoring the original readable text.

Does escaping change forward slashes?

No. Forward slashes are legal inside JSON strings, so the tool leaves them unescaped to keep your output clean and readable.

Can I escape text with emoji or non-Latin characters?

Yes. Those characters are valid in JSON strings, so they pass through as-is; only the characters JSON actually forbids are encoded.

Related free tools

Built by ByteVancer

ByteTools is a free product of ByteVancer, a software and web development studio building web apps, SaaS, and custom software. If you need developer tooling or a full product built for your team, explore what ByteVancer can do.