String Escape & Unescape

Escape or unescape text for JSON, JavaScript, HTML, XML, SQL, CSV, regex, shell and Unicode.

Runs instantly in your browser — results update as you type.

How do I escape a string for JSON?

Escaping adds backslashes or entities so special characters are treated as text: in JSON a double quote becomes \" and a new line becomes \n; in HTML < becomes &lt;; in SQL a single quote is doubled (''). Pick the format and the mode to convert instantly.

Formats

  • JSON / JavaScript — quotes, backslashes, new lines, tabs.
  • HTML / XML — &, <, >, quotes as entities.
  • SQL — doubles single quotes. Always prefer prepared statements in real code.
  • CSV — wraps fields that contain commas, quotes or line breaks.
  • Regex — escapes . * + ? ^ $ { } ( ) | [ ] \ /.
  • Shell — safe single-quoted string.

Frequently asked questions

Is escaping the same as encoding?

Related: URL encoding uses %XX codes — use the URL Encoder for that.

Does SQL escaping prevent injection?

It helps, but parameterised queries are the correct protection.

Is my text uploaded?

No.