Backslash Escape / Unescape
Escape and unescape strings for JSON, JavaScript and other languages.
Escape and unescape strings safely
The Backslash Escape / Unescape tool converts raw text into a safe string literal and back again. It escapes the characters that would otherwise break a string — double quotes, backslashes, newlines, tabs and other control characters — turning them into sequences like \", \\, \n and \t. Run it in reverse and those escape sequences are decoded back into the original, readable text.
How it works
Everything happens locally. You paste text on one side, choose whether to escape or unescape, and the transformation runs in JavaScript in your browser. Nothing is uploaded to a server, which matters when the string you are escaping is a config value, a snippet of source code or anything else you would rather keep private. The result updates as you work and is ready to copy into your editor.
When developers reach for it
- Pasting multi-line text into a JSON value or a JavaScript string literal without breaking the syntax.
- Embedding HTML, SQL or a file path inside a string constant.
- Reading an escaped log line or API payload back into plain, human-friendly text.
- Cleaning up strings copied out of code before you reuse them elsewhere.
It fits naturally alongside other formatting utilities. Use the JSON Formatter to tidy the object your escaped string lives in, the URL Encode / Decode tool for percent-encoding, or the HTML Entity Encoder when you need entity escaping instead of backslash escaping.
The tool is free, needs no account, and works in every modern browser including mobile. Because the escaping runs entirely client-side, your text never leaves the page.
Frequently asked questions
Escaping replaces special characters like quotes and newlines with backslash sequences so the text is safe inside a string literal. Unescaping reverses that, turning sequences like \n back into an actual newline.
Related tools
Base64 Encode / Decode
Encode text to Base64 and decode it back, with full Unicode support.
Base64 to Image
Preview and download an image from a Base64 or data-URI string.
Image to Base64
Turn any image into a Base64 data URI for CSS, HTML or JSON.
URL Encode / Decode
Percent-encode and decode URLs and query-string components safely.