TL
Tool Lab
💰Donate
💰Donate

String Escape / Unescape

Escape or unescape strings for JSON, JavaScript, HTML entities, SQL, and regular expressions.

Raw Input
Escaped Output

About This Tool

Escape and unescape strings for five contexts: JSON/JS strings, JavaScript template literals, HTML entities, SQL single-quote escaping, and RegExp patterns.

Paste any text, choose the escaping mode and language, and get the result instantly — useful for embedding strings in code without syntax errors.

How to Use

  1. Select Escape or Unescape mode.
  2. Click a language button (JSON, JS, HTML, SQL, or RegExp).
  3. Paste your input or click Sample to load an example.
  4. The output updates instantly. Click Copy to copy the result.

Use Cases

Developers escaping strings before embedding in JSON payloads, engineers escaping HTML before inserting into innerHTML, SQL developers escaping user input, and regex authors escaping literal strings for patterns.

FAQ

  • Should I use this for production SQL sanitization?No. Always use parameterized queries or prepared statements in production. This tool is for inspection and learning only.
  • What does unescape do for RegExp?RegExp unescape is context-dependent and not well-defined. This mode returns the input unchanged.
  • Does JSON escape handle Unicode?Control characters (U+0000–U+001F) are encoded as \uXXXX. Printable Unicode above U+007F is left as-is (valid JSON).