Yuzool

Dev Tools

String escape and unescape

Turn text into a safe string for JSON, JavaScript, SQL, CSV, a shell command, a regular expression or \u escapes, or turn an escaped string back into plain text.

The same text, escaped seven ways

Escaped by this page:

ForIt’s "here"\n
JSON stringIt's \"here\"\n
JavaScriptIt\'s \"here\"\n
Regular expressionIt's "here"
CSV field"It's ""here""
"
SQL string'It''s "here"
'
Shell argument'It'\''s "here"
'
XML textIt's "here"
Unicode escapes (\u)It's "here"

How to use it

  1. Pick Escape or Unescape, and what it’s for.
  2. Type or paste the text.
  3. Copy the result.

Questions

Why escape a string?

So quotes, backslashes and line breaks inside it don’t end the string early or change the code around it: the usual cause of broken JSON and SQL injection.

Should I build SQL by escaping?

Use your database library’s parameters (placeholders) instead; escaping is for one-off queries and quick fixes.

Related tools

Open all 35 Dev Tools. Everything runs in your browser; nothing you paste is uploaded.

Settings

History

Snippet