CalcCafe

JSON Escape

Escape any text so it can sit safely inside a JSON string — quotes, backslashes, tabs and newlines are all handled.

Example

Input
He said "JSON" is	great
and fast.
Output
He said \"JSON\" is\tgreat\nand fast.

How it works

The tool runs your text through JSON string-escaping rules: double quotes become \", backslashes become \\, and control characters like tab and newline become \t and \n.

Good to know

JSON Escape takes any raw text and converts the characters that would break a JSON string into their backslash-escaped equivalents, so the result can be dropped between a pair of double quotes inside a JSON document. It is aimed at developers, API testers, and anyone hand-editing config files, log messages, or request bodies who needs a snippet of arbitrary text to become a valid JSON string value without errors.

Reach for it whenever you are pasting human-written text, file contents, SQL, HTML, or another nested code block into a JSON field and you keep hitting "unexpected token" or "unterminated string" parse errors. Typical moments: building a Postman/cURL request body by hand, embedding a multi-line message into a single JSON property, or pasting Windows file paths (full of backslashes) into a config value.

Reading the output is straightforward: a literal double quote in your input becomes \", a backslash becomes \\, a tab becomes \t, and a line break becomes \n. The tool deliberately does not wrap the result in surrounding quotes, so you supply your own outer quotes — the output is the string body only. A quick sanity check is that the escaped text should contain no raw line breaks and no unescaped quotes.

One practical caveat: this tool escapes plain text into a single JSON string, so do not feed it text that is already escaped or you will get double-escaping (a single \n turning into \\n). If your goal is to wrap a whole value with quotes and proper typing, a JSON stringify tool is the better fit; use JSON Escape only when you need the bare, quote-safe string body.

Frequently asked questions

Does it add surrounding quotes?
No — it returns the escaped content without the outer quotes, so you can drop it between your own quotes.
What characters are escaped?
Double quotes, backslashes, and control characters (tab, newline, carriage return and similar).
Is my JSON uploaded anywhere?
No — everything runs in your browser with JavaScript. Your data never leaves your device, so it's safe for sensitive payloads and works offline once loaded.
Is this tool free?
Yes, completely free with no sign-up and no limits.

More JSON tools

People also ask

What is the difference between JSON escape and JSON stringify?
JSON escape only converts the special characters inside a string (quotes, backslashes, control chars) and gives you the bare escaped body. JSON stringify wraps the value in quotes and produces a complete, valid JSON value, and it can also serialize objects and arrays, not just text.
How do I escape a double quote inside a JSON string?
Replace each literal double quote with a backslash followed by a quote, written as \". This tells the JSON parser the quote is part of the string content rather than the end of the string.
Do I need to escape single quotes (apostrophes) in JSON?
No. JSON strings are delimited only by double quotes, so single quotes/apostrophes are ordinary characters and require no escaping.
How are newlines and tabs represented in a JSON string?
A newline becomes \n, a carriage return becomes \r, and a tab becomes \t. Literal, unescaped line breaks are not allowed inside a JSON string and will cause a parse error.
Why do file paths break my JSON, and how do I fix them?
Windows paths use backslashes, and a single backslash is JSON's escape character, so something like C:\Users is misread. Escape each backslash by doubling it (C:\\Users), which this tool does automatically.
Can I reverse the process and unescape a JSON string?
Escaping and unescaping are opposite operations. To turn \n, \t, and \" back into real line breaks, tabs, and quotes you would parse the JSON string or use an unescape tool rather than this escape tool.
Will escaping change non-ASCII or Unicode characters like emoji?
Standard JSON string escaping only requires handling quotes, backslashes, and control characters; printable Unicode such as accented letters and emoji can remain as-is in UTF-8 encoded JSON. Some tools optionally convert them to \uXXXX sequences, but that is not required for valid JSON.
Is it safe to escape passwords or API keys with an online tool?
With this tool the work happens entirely in your browser using JavaScript, so the text is not uploaded to any server. That makes it usable offline and means sensitive values stay on your device.