JSON Escape Online
Paste any text and get a safe JSON string. Quotes, backslashes, line breaks, tabs and control characters are escaped the way the JSON specification requires. It runs on your device and nothing is uploaded.
How to use JSON Escape on KickSolve
Three quick steps, no account needed.
Why choose KickSolve
Built for speed, privacy and accurate results.
About JSON Escape on KickSolve
What it does and how to get the best results.
What is JSON escaping?
A JSON string is wrapped in double quotes, so some characters cannot appear in it as they are. Escaping replaces each of them with a short backslash sequence, which keeps the string valid and lets any parser read it back to the exact original text.
Characters that must be escaped in JSON
| Character | Escaped as |
|---|---|
| Double quote | \" |
| Backslash | \\ |
| New line | \n |
| Carriage return | \r |
| Tab | \t |
| Backspace and form feed | \b and \f |
| Other control characters (U+0000 to U+001F) | \u00XX |
A forward slash may be written as \/ but does not have to be. A single quote never needs escaping in JSON, and \' is not a valid JSON escape.
How to escape a string for JSON online
Paste your text in the top box. The escaped version appears below at once. Turn on Wrap result in double quotes if you want a complete JSON string value, or Escape non-ASCII to turn accents, symbols and emoji into \u codes for systems that only accept ASCII.
Escaping JSON inside another JSON string
APIs often carry a JSON document as the text of a field. Paste the inner JSON here and every quote gets a backslash, so it can sit safely inside the outer string. To read it back, use the JSON unescape page.
Escape JSON in code
In JavaScript use JSON.stringify(text), in Python json.dumps(text) and in PHP json_encode($text). This page is the fast way to check what those functions will produce or to escape a one-off string without writing code.
JSON Escape examples
Real input and output so you can see exactly what changes.
Quotes, a new line and a backslash
Input
He said "Hi"
Path: C:\tempOutput
He said \"Hi\"\nPath: C:\\tempJSON inside a JSON string
Input
{"name": "Ana"}Output
{\"name\": \"Ana\"}Non-ASCII turned into \u codes
Input
café 😀Output
caf\u00e9 \ud83d\ude00When do you need to escape a JSON string?
Common reasons people use this page.
Privacy, limits and browser support
What happens to your data and what to expect.
- How it works: with KickSolve, the conversion runs in your browser with JavaScript. Your text is not sent to a server and is not stored.
- Limits: there is no limit set by us. Very large text, many megabytes, depends on your device memory.
- Browsers: current Chrome, Edge, Firefox and Safari on desktop and mobile.
Read the KickSolve privacy policy for details about the site itself.
Frequently asked questions
Quick answers.
How do I escape a string for JSON?
Paste the text into the top box. The escaped result appears below. Quotes, backslashes, new lines, tabs and control characters are converted to JSON escape sequences.
Which characters must be escaped in JSON?
The double quote, the backslash and the control characters U+0000 to U+001F. Common ones are written as \n, \r, \t, \b and \f, the rest as \u00XX.
Do single quotes need escaping in JSON?
No. A single quote is a normal character in a JSON string. The sequence \' is not valid JSON.
Is a forward slash escaped in JSON?
It can be written as \/ but it is optional. Turn on Escape forward slashes if your parser or HTML embedding needs it.
How do I escape Unicode or emoji?
Turn on Escape non-ASCII. Each character above U+007F becomes a \uXXXX code. Emoji become two codes called a surrogate pair, which is correct for JSON.
Is this the same as JSON.stringify?
Yes for the escaped content. JSON.stringify also adds the outer quotes, which you get with Wrap result in double quotes.
Is my text uploaded anywhere?
No. The conversion runs in your browser and your text never leaves your device.
Is it free?
Yes. It is free, needs no signup and has no limit set by a server.
More free tools from KickSolve
Related string and developer tools.