String Escaper / Unescaper
Escape text into a safe JSON string body (quotes, newlines, tabs, backslashes) or unescape it back to plain text — instantly.
We use cookies and similar technologies to enhance your browsing experience, analyze site traffic, and personalize content and ads. By clicking "Accept", you consent to our use of cookies. Learn more in our Privacy Policy.
Escape text into a safe JSON string body (quotes, newlines, tabs, backslashes) or unescape it back to plain text — instantly.
The String Escaper / Unescaper turns ordinary text into a valid JSON string body and back again. Paste a code snippet, a multi-line log, or a sentence with quotes, and it converts the characters that would break a JSON string — double quotes, backslashes, newlines, tabs, carriage returns — into their escaped forms (", \, \n, \t, \r). The unescape direction does the reverse, decoding an escaped string back to its literal text so you can read it normally.
It's built for the moment you need to drop a chunk of text into a JSON field, a config file, a string constant, or an API request and don't want to hand-escape every quote and line break. Everything runs in your browser; the text you paste never leaves your device, which matters when the snippet is a private key, an internal log line, or anything you'd rather not send to a server.
The tool has two modes:
" becomes \", \ becomes \\, a newline becomes \n, a tab becomes \t, and a carriage return becomes \r.\n back into a real line break, \" back into ", and so on.It does not add the surrounding quotes for you — it produces the body of the string, so you can paste it straight between your own quotes wherever you need it. Processing happens entirely client-side: nothing is uploaded, and the result updates as you type.
Say you have this two-line message with a quoted word:
She said "hi".
Then left.
Escaping it gives you a single safe line:
She said \"hi\".\nThen left.
Drop that between quotes and it's a valid JSON value:
{ "message": "She said \"hi\".\nThen left." }
Run the same escaped text through Unescape and you get the original two lines back, quotes and line break restored. The backslash is the part people forget: a Windows path like C:\Users\me has to become C:\\Users\\me, otherwise \U and \m are read as (invalid) escape sequences and the JSON fails to parse.
.json config without breaking it.\n and \".\n-littered log string back into readable, line-broken text for debugging.\n or \" get double-escaped. The tool handles this for you, but it's the most common mistake when people do it by hand." — pasting the output already wrapped in quotes will double them up.' passes through unchanged.\ in unescape mode has nothing to pair with.\t or \r after escaping, which is a useful way to spot whitespace you didn't know was there.A JSON string is delimited by double quotes, so the parser needs an unambiguous way to tell a quote that ends the string from a quote that's part of the string. That's what the backslash escape does: \" means "a literal quote, keep going." The same logic covers the backslash itself (\\) and characters that can't appear literally inside a string at all — newlines, tabs, and other control characters below code point U+0020.
Those control characters are forbidden raw: a real line break inside a JSON string is a parse error, which is why a newline must be written as the two characters \n. JSON also allows a \uXXXX form for any Unicode character, but for everyday text the short escapes (\n, \t, \r, \", \\) are all you need, and they're exactly what this tool produces. Most C-style languages — JavaScript, Java, C#, Python — use the same set, so escaped JSON bodies usually drop straight into their string literals too.
Escaping converts raw text into a form that's safe to place inside a JSON string (real newlines become \n, quotes become \"). Unescaping does the reverse, turning \n back into an actual line break and \" back into a quote so the text is readable again.
No. It produces the body of the string — the part that goes between the quotes — so you can paste it into whatever field or literal you're building. Add the quotes yourself.
Double quote (\"), backslash (\\), newline (\n), carriage return (\r), and tab (\t). These are the characters that would otherwise break a JSON string.
Inside a JSON string, a backslash starts an escape sequence, so a literal backslash has to be written as two: \\. Skip this and paths like C:\new get misread, because \n is interpreted as a newline.
Usually yes. JavaScript, Python, Java, and C# all share JSON's core escape sequences (\n, \t, \", \\), so an escaped JSON body normally drops straight into a string literal in those languages.
No. Escaping and unescaping run entirely in your browser. Nothing is sent to a server, so it's safe for private logs, keys, or internal snippets.
A raw line break inside a JSON string is a parse error. JSON requires control characters like newlines and tabs to be written as escape sequences, so a newline becomes the two characters \n.
Unescape mode expects valid escape sequences. A lone backslash with nothing valid after it, or an incomplete \u sequence, has no clean counterpart and won't round-trip. Check that the input is actually escaped text, not raw text.