Paste your text on the left and instantly get escaped text on the right.
Ever pasted a quote-laden text into a script or a command line—only to watch it break spectacularly? That's where this Text escaper comes in handy. It's a simple, browser-based utility designed to escape special characters using slashes, so your text behaves nicely in any technical context.
Whether you're coding in PHP, working with JSON, preparing strings for shell scripts, or just want clean, safe text output, this online escape tool saves you from tedious manual cleanup. I built it for fellow developers, sysadmins, content wranglers, and anyone tired of broken strings. Enjoy – and if it saves you a headache, share the love!
Once you paste your text into the left input box, the tool immediately processes it and shows the escaped version on the right – no clicks needed, no delay. It uses standard slash escaping, mimicking the behavior of PHP's addslashes() function. That means it's great for developers but simple enough for anyone to use.
Here's what gets escaped:
" becomes \"' becomes \'\ becomes \\\n\tWorking with raw text in programming, scripting, or data formats often comes with a hidden trap: special characters that break everything. A stray quotation mark can terminate a string. A rogue backslash can change the meaning of a path. A newline in the wrong place can cause scripts to crash or misbehave.
By escaping text – that is, adding backslashes before special symbols – you make sure that the text is treated exactly as intended. This is especially critical when embedding strings in code, generating JSON, passing values through APIs, or even preparing user input for storage.
This tool exists to take the guesswork and frustration out of that process. Whether you're a developer cleaning up data, a sysadmin crafting scripts, or just someone trying to paste a string into a terminal without it exploding — escaping your text properly can save you hours of debugging.
It depends on the format. JavaScript / general escapes backslashes, both quotes, newlines, carriage returns, tabs, \0 \b \f \v, other control characters as \xHH, and the line and paragraph separators U+2028 and U+2029. JSON string does exactly what JSON.stringify does and leaves single quotes alone. SQL doubles single quotes. CSV doubles double quotes and wraps the field in quotes.
Whenever a string has to survive being embedded in code or data: a JavaScript string, a JSON value, a SQL literal or a CSV field.
The backslash is the escape character itself, so it has to be escaped to survive as a literal backslash. One backslash in becomes two out.
Escaping adds backslashes so a string survives inside code. URL encoding turns characters into percent codes so they survive inside a web address. They solve different problems and are not interchangeable.
No. Escaping adds backslashes for code contexts. HTML encoding turns characters into entities for use in markup, which is what the HTML Entity Encoder is for. And if your quotes are curly rather than straight, escaping will not save the string: run it through the Smart Quote Converter first.
Yes. Switch to Unescape and pick the same format. It reads \n \r \t \\ \' \" \0 \b \f \v, \xHH, \uHHHH and \u{...}. An unknown escape such as \q keeps just the letter.
JSON has no \' escape, so a string escaped for JavaScript can fail to parse as JSON. Choose JSON string and single quotes are left as they are.