UtilDojo

Popular

Menu

String Escape & Unescape Online — JSON, JavaScript, Regex

  • This tool runs entirely in your browser. Nothing you enter or upload is sent to a server.

Text

Escaped

Result appears here.

The result has no surrounding quotes: paste it between the quotes of your string literal.

About this tool

Paste text and choose what it is going into. JSON and JavaScript escaping handles quotes, backslashes, newlines, tabs and control characters. Regex escaping makes special characters match literally. SQL escaping doubles single quotes.

Switch to Unescape to turn \n, \u00e9 and \u{1F600} sequences back into real characters, which is handy for reading logs and API responses full of escaped strings.

The result has no surrounding quotes, so you paste it between the quotes of your literal. For JavaScript, backticks and ${ are escaped too, so it is safe in template strings.

Frequently asked questions

How do I escape a string for JSON?

Choose “JSON string” and paste your text. Double quotes, backslashes, newlines and control characters are escaped, and you can paste the result between the quotes of a JSON value.

Is escaping enough to prevent SQL injection?

No. Doubling quotes is only for writing literals by hand or in one-off scripts. In application code, always use parameterized queries.

How do I match a special character literally in a regex?

Choose “Regex” and paste the text. Characters such as . * + ? ( ) [ ] are backslash-escaped so the pattern matches the text exactly.

Related tools