String Escape & Unescape Tool
Escape text for many contexts at once, or unescape it back to plain text.
How it works
- Choose Escape or Unescape.
- Type or paste your text.
- Copy the result you need from the list.
About this tool
Different places need special characters to be escaped in different ways. A quote must be escaped in a JSON string, a dot in a regex, an angle bracket in HTML and a space in a URL. This tool shows all of the results at once, so you can copy the one you need.
It handles JSON strings, JavaScript strings, regular expressions, HTML, URL components, CSV fields, SQL string literals and shell arguments, and can reverse JSON, JavaScript, regex, HTML and URL escaping. For SQL, use parameterised queries in real code; the SQL output is only for quick manual work.
Questions
Which escape do I need for JSON?
Use the JSON string result. It escapes quotes, backslashes and line breaks.
Is SQL escaping safe for user input?
No. Always use parameterised queries in real applications.
Can it decode a URL?
Yes. Choose Unescape and use the URL component result.