JSON Escape Unescape
Escape special characters, Unicode, and control characters in JSON strings — or unescape them back
Character Analysis
Paste raw text containing quotes, newlines, backslashes, or Unicode and get a properly escaped JSON string back instantly — or go the other way and turn escape sequences into readable text. No more guessing which characters need a backslash. And everything runs in your browser. Nothing gets uploaded.
How It Works
The escaper scans each character in your input. Control characters (newlines, tabs, carriage returns), backslashes, and double quotes get replaced with their backslash-prefixed equivalents. Any character outside basic ASCII is converted to a \uXXXX hex code if you have Unicode escaping turned on. Unescaping reverses the whole process — it reads escape sequences and restores the original characters.
Examples
Escaping a User Bio with Quotes and Newlines
A user profile bio that contains line breaks and quotation marks — the kind of thing that breaks JSON if you drop it in raw.
She said "hello"
and waved.
She said \"hello\"\nand waved.
File Path with Backslashes
Windows file paths are notorious for breaking JSON because every backslash needs doubling.
C:\Users\Admin\Documents\report.pdf
C:\\Users\\Admin\\Documents\\report.pdf
Unescaping an API Response for Debugging
You pulled a JSON string from an API log and it's full of escape sequences. Hard to read. Paste it in unescape mode and the original text comes right back.
Error:\tFile not found\n\"config.json\" is missing
Error: File not found
"config.json" is missing
Who Uses This
Prepping user-submitted strings for JSON API responses without breaking the payload.
Reading escaped log entries and API responses during bug investigations.
Cleaning messy JSON exports where fields contain escaped newlines and tabs.
Learning how JSON string encoding works by seeing escape sequences side by side with raw text.
Common Mistakes
You escape a string, then paste the result into code that escapes it again. Now \n becomes \\n and nothing renders correctly. Only escape once — right before the string enters your JSON structure.
Some people only escape the "obvious" characters like quotes but skip tabs or control characters. A stray tab character will still break your JSON parser. Run the full string through the escaper, not just the parts you noticed.
JSON escaping, HTML entity encoding, and URL percent-encoding are three different things. & is HTML. %20 is URL. \n is JSON. Mixing them up produces strings that look right in one context but break in another.
Technical Details
- Processing: 100% client-side — nothing is sent to any server
- Browser Support: Chrome, Firefox, Safari, Edge
- Characters Escaped:
"\/plus control chars (\n\r\t\b\f) and optional Unicode - Max Input: Limited only by your browser's available memory
Frequently Asked Questions
What characters need to be escaped in JSON?
The JSON spec requires escaping double quotes ("), backslashes (\), and control characters like newline, tab, carriage return, backspace, and form feed. Forward slashes can optionally be escaped too. Everything else — regular letters, numbers, most punctuation — goes through as-is.
Do I need to escape single quotes in JSON?
No. JSON strings are always wrapped in double quotes, so single quotes don't need escaping. This trips up a lot of people coming from JavaScript or Python where both quote types work. In JSON, single quotes inside a string value are perfectly fine left as they are.
What's the difference between JSON escape and JSON stringify?
JSON escaping handles the individual characters inside a string value — turning a newline into \n, a quote into \", and so on. JSON stringify (JSON.stringify()) takes an entire JavaScript object or value and converts it into a complete JSON text, which includes escaping strings but also adds the outer quotes and handles nested structures. Escaping is one part of what stringify does.
How do I escape a newline in JSON?
A newline becomes \n in a JSON string. That's a literal backslash followed by the letter n — not an actual line break. If you have a carriage return + newline (Windows-style), you'd escape that as \r\n. This tool handles both automatically.
Is JSON escaping the same as URL encoding?
Not at all. They solve different problems. JSON escaping uses backslash sequences (\n, \") for special characters inside JSON string values. URL encoding uses percent signs (%20, %2F) for characters that aren't safe in URLs. You can't swap one for the other — a %20 in a JSON string is just the literal text "%20", not a space.