Tools / String Escape/Unescape

String Escape/Unescape.

Escape and unescape strings for different formats.

About String Escape/Unescape

String escaping converts special characters into safe representations for different contexts — JSON, HTML, URLs, and more. This tool handles both escaping (making strings safe for a target format) and unescaping (restoring original characters). Essential for debugging data that has been escaped multiple times, preparing strings for embedding in code, and handling user input safely.

How to Use

  1. Enter the string to escape or unescape.
  2. Select the target format (JSON, HTML, URL, etc.).
  3. Click "Escape" or "Unescape".
  4. Copy the result.

Key Features

  • Escape for JSON, HTML, URL formats
  • Unescape back to original characters
  • Handle special characters and Unicode
  • Multiple format support

Common Use Cases

  • Preparing strings for JSON embedding
  • Escaping HTML special characters
  • URL-encoding query parameters
  • Debugging double-escaped strings

Frequently Asked Questions

What is string escaping?

String escaping replaces special characters with escape sequences. For example, in JSON, a newline becomes \n and a quote becomes \". This prevents the characters from being interpreted as syntax.

Why do I see double backslashes?

Double backslashes (\\) usually mean the string has been escaped twice. Use the unescape function to remove one layer of escaping.

What characters need escaping in JSON?

In JSON, you must escape: double quotes ("), backslashes (\), and control characters (newline, tab, etc.). Forward slashes (/) can optionally be escaped.

Is this the same as URL encoding?

No. URL encoding (percent-encoding) is a specific type of escaping for URLs. JSON escaping and HTML escaping use different rules. This tool handles all three formats.

Related Tools