HTML & JSON Escape / Unescape
Select a mode and then escape or unescape special characters.
About HTML & JSON Escape / Unescape

Escaping is the process of converting special characters into a different representation to prevent them from being misinterpreted. Unescaping is the reverse process. This tool handles escaping for both HTML and JSON string contexts.

Why is this important?

  • HTML: Escaping user-generated content before displaying it on a web page is critical for preventing Cross-Site Scripting (XSS) attacks. Characters like < and > are converted to their HTML entity equivalents (e.g., <) so the browser renders them as text instead of executing them as code.
  • JSON: When including a string within a JSON structure, special characters like double quotes (") and backslashes (\) must be escaped with a backslash (e.g., \") to ensure the JSON remains valid.

How It Works

The tool provides two modes. In HTML mode, it converts characters to their corresponding HTML entities. In JSON mode, it adds the necessary backslash escapes to produce a valid JSON string value.