This tool does a JSON escape for you: it turns text with quotes, line breaks and special characters into a string that is safe inside JSON, XML, CSV or SQL. It also works in reverse, so you can turn escaped text back into normal, readable text. It is built for developers, analysts and anyone who has pasted text into a file and watched it break.
How do you escape or unescape a string?
The tool has three steps, and each one matches what you see on the page.
- Choose Escape or Unescape, then pick the format: JSON/JavaScript, XML, CSV or SQL.
- Paste your text into the input box.
- Copy the result and use it in your code, file or query.

This tool pairs well with the HTML Entity Encoder / Decoder. If you do this kind of job often, the JSON Formatter & Validator and the Chmod Calculator can save you time too.
Everything runs in your browser. Your text is not uploaded anywhere, which matters when you are working with logs, customer data or API payloads. The tool is free to use.
What does escaping actually do?
Every format has characters that mean something special. A double quote ends a JSON string. An ampersand starts an XML entity. A comma splits a CSV field. A single quote closes a SQL string. Escaping marks those characters as plain text, so the parser reads them as content and not as syntax.
Unescaping does the opposite. It takes the marked-up version, such as \n or &, and gives you the original characters back.

Escape rules at a glance
These are the standard conventions for each format. The examples show the idea, so use the tool for the exact output.
| Format | Plain text | Escaped |
|---|---|---|
| JSON / JavaScript | He said "hi" | He said \"hi\" |
| XML | 5 < 6 & 7 | 5 < 6 & 7 |
| CSV | 5" pipe, steel | "5"" pipe, steel" |
| SQL | O'Brien | O''Brien |
What is a JSON escape tool good for?
- Putting text inside a JSON value. Paste a paragraph with quotes and line breaks, and get a string you can drop into a request body or config file.
- Reading escaped API responses. Use JSON unescape on a string full of backslashes to see the real text.
- Preparing XML. Escape text that contains ampersands or angle brackets before it goes into a feed or markup.
- Cleaning up CSV fields. Handle values with commas, quotes or line breaks so they do not shift columns.
- Writing SQL by hand. Escape a name like O'Brien so a quick query or test script does not fail on the apostrophe.
Tips for better results
- Pick the format first. The same character is handled differently in each format. A quote in JSON is not treated like a quote in CSV.
- Escape only the value, not the whole document. If you paste a full JSON object, the structural quotes will be escaped too and the object will stop being valid JSON.
- Escape once. Running text through Escape twice adds a second layer of backslashes or entities. If the result looks cluttered, you have probably doubled up.
- Check line breaks. In JSON, a real new line becomes \n. If your output sits on one long line, that is expected.
- Test small samples first. Try a short string with the awkward characters before you process a large block.
Common problems and how to fix them
My JSON still will not parse
Look for an unescaped quote or backslash outside the part you converted. Also check for a trailing comma or a missing bracket. Escaping fixes characters inside a string, not the structure around it.
I see backslashes everywhere
The text was probably escaped more than once. Switch to Unescape and run it a single time, then check whether it reads normally.
My CSV columns are shifted
A field with a comma or line break needs to be wrapped in double quotes, and any inner quotes doubled. Escape the field in CSV mode and paste it back in.
A SQL query breaks on an apostrophe
The single quote closed your string early. Escape the value in SQL mode. For anything that runs in production, parameterised queries are the safer habit, and escaping by hand is best kept for quick, one-off work.
Escape or unescape: which one do you need?
Choose Escape when you are putting raw text into a format. Choose Unescape when you are reading text that already came out of one. If you can see sequences like \", \n or < in text meant for people, you need Unescape.
