String Escape Tool

Escape and unescape a string for JSON, JavaScript, URL, or SQL, covering backslashes, quotes, control characters, and all percent escapes. Both directions.

The string escape tool escapes a value for a target format and reverses it again. The same string needs different escapes in JSON, JavaScript, a URL, and a SQL literal, which is why the format is a choice here.

Output

                

Paste or type something above.

Questions about string escape tool

When should I use SQL escaping?
For a literal inside a query string, a single quote is doubled. For anything user-supplied, use a parameterised query instead.
Does JSON escaping keep non-ASCII characters?
Yes. Only the backslash, the double quote, and control characters are escaped, so accented text and emoji stay readable.
What if my unescape fails?
JSON unescaping reports the exact problem, because a malformed escape is a real bug in the data rather than something to paper over.