Skip to main content
WizTools123
WizTools123
Free Online Tools

Tool Categories


Text Tools New Tool

Free Online JSON String Escaper and Unescaper

Escape any text so it can be dropped inside a JSON string, or take an escaped string and turn it back into plain readable text, all in your browser. Quotes, backslashes, line breaks and tabs are handled properly, characters outside plain ASCII can be written as escapes, and the result can be wrapped in quotes ready to paste.

Free Forever Nothing Uploaded Both directions Valid output
Free Online JSON String Escaper and Unescaper
Share this tool
Advertisement Slot (Top Banner) Google AdSense Unit • Responsive Banner
JSON String Escaper Everything happens in this tab. Nothing you paste is sent anywhere.
Your text
0 characters 0 words 0 lines
Result
0 characters 0 lines
Direction
Escaping
Line breaks

0 characters in 0 characters out 0 escaped - result

Buy Us A Coffee

Enjoying WizTools123? Help keep our server infrastructure 100% free and open for everyone.

Buy Us A Coffee
Sponsored Content (Below Tool) Google AdSense Placement

How to Escape Text For JSON

A few steps, and nothing is uploaded.

1
Paste the text Plain text to escape, or an already escaped string to turn back. A .txt file can be dropped onto the box.
2
Choose the direction Escaping is the common case. Unescaping is for reading a string you found in a file or a log and cannot make sense of.
3
Decide about the quotes and the line breaks Wrapping in quotes gives you something you can paste straight in. A JSON array is the better shape when the text is a list.
4
Check the result and copy The counter says whether the escaped result is valid JSON, which is the quickest way to know it will not break the file you paste it into.

What to Know About Escaping For JSON

What must be escaped, what may be, and what must not.

JSON requires exactly five escapes and two kinds of character. The double quote, the backslash and any control character below space must be escaped. Line breaks, tabs, carriage returns, form feeds and backspaces have short forms. Everything else may be left as it is, and escaping more than necessary is legal but noisy.
The forward slash escape is allowed but almost never needed. It exists because a sequence that looks like the end of an HTML script tag can cause trouble when JSON is embedded in a page. If you are not embedding JSON inside HTML, leave it switched off.
JSON has no single quoted strings. A string must use double quotes, which is the single most common reason a hand written JSON file is rejected. If you are copying from JavaScript or Python, the quotes have to change as well as the escapes.
Escaping beyond ASCII is for compatibility, not correctness. JSON files are UTF-8, so an accented letter or an emoji can appear as itself. Writing them as escapes instead makes the file safe for older systems that mangle anything above ASCII, at the cost of a result nobody can read.
Unescaping is forgiving, and that means it accepts things JSON would not. It reads the standard escapes, the four digit unicode form including surrogate pairs, and the two digit hex form that JavaScript allows but JSON does not. That is useful for making sense of a string you found, and it means a successful unescape is not proof the input was valid JSON.

Key Features & Capabilities

What this tool does, and what it deliberately does not.

Correct escaping Quotes, backslashes and every control character handled exactly as the JSON specification requires.
Both directions Escape for pasting into a file, or unescape to read a string you found in a log or a config.
Result is checked The escaped output is parsed back to confirm it really is a valid JSON string before you paste it anywhere.
Array output Multi line text can come out as a JSON array with one string per line, which is usually the better shape.
ASCII only option Accents, other alphabets and emoji can be written as escapes for systems that cannot cope with them.
Nothing is uploaded Keys, config values and log lines are escaped in this tab and never sent anywhere.

About the JSON String Escaper

Putting text inside a JSON string is one of those jobs that looks trivial until a quotation mark ruins an afternoon. A Windows file path has backslashes that mean something else. A quoted sentence closes the string early. A pasted paragraph has line breaks that JSON does not allow inside a string at all. Each of those produces a parse error several lines away from the real problem.

This page is deliberately smaller than a JSON formatter. It does not care about your objects, your arrays or your indentation. It takes one piece of text and makes it safe to live inside a pair of double quotes, which is the specific thing a formatter cannot help with because the text is not valid JSON yet.

The unescape direction gets used more than people expect. Logs, error messages and configuration files are full of strings that have been escaped once or twice, and reading a Windows path with four backslashes in it is genuinely hard. Turning it back into plain text takes a second and often shows immediately what is wrong.

Frequently Asked Questions

Quotes, slashes, unicode escapes and single quotes.

Because JSON does not have them. A string must be in double quotes, with no exceptions, which is why JSON copied out of JavaScript or Python is so often rejected. The quotes have to be changed as well as the contents escaped.

Almost never. It is permitted but not required, and the only real reason for it is when JSON is embedded inside an HTML page, where a particular sequence can look like the end of a script tag.

JSON strings cannot contain a real line break, so they must become an escape. If the text is really a list, the array option is better, because one string per line is easier to read and easier to work with afterwards.

Only if something downstream needs it. JSON is UTF-8, so accented letters and emoji are perfectly legal as themselves. Escaping them is for older systems and makes the output much harder for a human to read.

The result counter tells you. The escaped output is parsed back as JSON, and if it does not come out identical to what went in, the counter says so rather than letting you paste something broken.

Other Text Tools

Advertisement Slot (Bottom Banner) Google AdSense Unit • Responsive Banner