Developer tools

Escape and Unescape Strings: JSON, JavaScript, SQL, Regex

Free, no sign-up, works in your browser. Escape text so it fits safely inside a JSON, JavaScript, CSV, SQL, regular expression or XML string, or turn escaped text like \n and \" back into plain text.

Direction
For

For a value inside a JSON string: quotes, backslashes, line breaks and control characters get a backslash.

Everything happens on your device.

How to use the String Escape and Unescape

  1. Choose Escape or Unescape.
  2. Pick where the text is going: JSON, JavaScript, CSV, SQL, Regex or XML.
  3. Paste your text and copy the result.

Frequently asked questions

What does escaping a string mean?
Adding marks, usually backslashes, before characters that would otherwise end the string or change its meaning, such as quotes and line breaks.
JSON or JavaScript?
JSON allows only a few escapes such as \n, \" and \u00e9. JavaScript also escapes single quotes and backticks and accepts more forms when unescaping.
Is escaping enough to stop SQL injection?
No. Use your database library's query parameters in real code. Escaping here is for quick, one-off queries.
Is my text uploaded?
No. Everything happens on your device.
Is String Escape and Unescape free?
Yes. It's free to use, with no sign-up and nothing to install.