String Escaper
String Escaper — runs in your browser. Inputs are not stored.
String escape
\n \t \" \\ and standard JSON string escapes (\r \b \f \uXXXX) are processed.
How to use
- Paste original text or an already escaped string into Input.
- If you will put the value in code, press Escape. Newlines become backslash n.
- To read an escaped value again, press Unescape.
- To check a round trip, use Swap input and output then the opposite button.
- Finish with Copy result or Reset.
Key concepts
String escape is for a JSON string value, some logs, or a one-line paste into code. It handles newlines, tabs, quotes, and backslashes plus carriage return, backspace, form feed, and Unicode \uXXXX forms. It is not a formatter for a whole JSON document; it works on one value blob.
Unescape restores real newlines and quotes. Invalid sequences show a status message. Processing runs only in the browser. HTML-entity escaping and SQL quote escaping are not handled—use other tools for those.
Example
Escape two lines line1 and line2 and you get backslash n on one line. A sentence with quotes becomes backslash plus quotes. Unescape that result to restore the original two lines and quotes. It is most useful for a one-line message to drop into JSON, and the role differs from formatting a whole file. After unescape, real newlines improve log readability and debugging. An odd number of trailing backslashes can break a sequence—check the original again. When you retry the same input, reset first. On a shared computer, clear the fields when you finish. Closing the tab discards what you pasted; you do not need a server delete request. Button names match the tool above. If the result is empty, check required fields and hidden errors. This page is usage help, not a claim that input is stored elsewhere.
Related: JSON formatter · JSON encoder · Text ↔ Base64
Frequently asked questions
Can I string-escape a whole JSON document?
It is a value-level tool. Use a JSON formatter to tidy a document.
Does JSON escaping include Unicode escapes too?
It handles Unicode-escape forms used in ordinary JSON strings.
Does it also convert HTML entities?
No. It only handles JSON-style newlines, tabs, quotes, and similar.
Is input sent to a server?
No. Conversion runs only in the browser.
When do I use swap input and output?
When you want to lift a just-made escape result back into input and check that unescape is correct.
Does SQL single-quote escaping work too?
It is JSON style. SQL quote rules are not applied.
Last reviewed: 2026-09-04