String Escape and Unescape
Everything runs in the browser; your text is never uploaded
How to Use
📖 Tool Introduction
Move a string back and forth between its literal form and its escaped form, handling newlines, carriage returns, tabs, quotes and backslashes.
This comes up constantly when writing code. A string printed in a log shows the two characters of an escape sequence instead of an actual line break, so you cannot tell what the value really contains. A piece of text taken from a JSON payload and pasted into source breaks the syntax the moment it contains a quote. Escaping is the direction that turns invisible characters into visible sequences you can read and type; unescaping turns them back into what they stood for.
The order of replacement is the part that decides whether the tool is correct. The backslash itself has to be handled before anything else, because every later pass writes a backslash of its own. If newlines were escaped first and backslashes second, a backslash the user had typed would gain a second one and the string would grow every time it went through, which is the classic way an escaping routine ends up producing nonsense. Here the backslash goes first, then the newline, carriage return, tab and the two quote characters.
Unescaping matches a backslash followed by one character and looks that pair up in a table. Anything not in the table is passed through untouched rather than raising an error, which matters because escape-like sequences that are not standard turn up all the time in real input, particularly inside regular expressions where a backslash followed by a letter often means something specific to that dialect.
The result reports the input length, the output length and how many replacements were made, which is enough to tell whether a round trip came back to where it started.
Where this earns its keep is nested data. A JSON payload that itself contains JSON has been escaped once to sit inside a string, and reading it means unescaping exactly one level rather than every level at once, because unescaping twice silently destroys the inner structure. Logs of HTTP bodies, messages pushed through a queue and values stored in a single database column all arrive in that state, and the practical habit is to unescape once, look at what comes out, and only then decide whether another pass is warranted. Counting the replacements is what tells you whether the pass did anything at all, since an input with no escapes comes back identical and looks exactly like a failure.
✨ Key Features
- Both directions, escaping and unescaping
- Control characters: newline, carriage return, tab, backspace, form feed
- Quotes of both kinds, the backslash and the slash
- Backslash handled first so nothing is escaped twice
- Unrecognised sequences pass through instead of raising an error
- Runs locally: nothing is uploaded
🚀 How to Use
- Paste the string on the left
- Pick escape or unescape on the right
- Press process, or use Ctrl plus Enter
- The result box shows the output and how many replacements were made
- Copy result puts it on your clipboard
⚠️ Things to Note
- Data source: Based on the escape sequences common across programming languages; conversion runs in the browser
- Dialects differ slightly: Languages disagree on a few sequences; this follows the most widely used convention
- For Unicode escapes: Sequences of the form backslash u followed by hex belong with the Unicode converter
- Backslashes in regex: A sequence such as backslash d is not in the standard table and is left as it is
- Privacy: Everything runs in the browser. What you paste is never sent to a server