HTML Escape / Unescape
Escape or decode HTML special characters in text.
Your result will appear here…
How to use HTML Escape / Unescape
- Choose Escape to encode markup or Unescape to decode it.
- Paste the markup, or the text that contains character references.
- Run the conversion and copy the output.
Example
Input / settings:
<button title="Hello">Tom & Jerry</button>
Output:
<button title="Hello">Tom & Jerry</button>
The apostrophe is written as '. Unescape turns this exact output back into the original text.
When to use
- Show an HTML snippet as visible text in documentation or a comment.
- Prepare a value for insertion into HTML text content.
- Read escaped markup copied from page source or an API response.
Overview
HTML Escape replaces the five characters that have special meaning in HTML text — &, <, >, " and ' — with character references so the text is displayed literally. Unescape reverses exactly those five references and nothing else. Other characters, including accented letters and symbols, are left unchanged.
Supported input
Any text to escape, or text containing &, <, >, " and ' references to unescape.
Output details
Text with &, <, >, double quotes and single quotes replaced by character references, or the decoded text.
Common mistakes
- Escaping twice double-encodes the text: Tom & Jerry becomes Tom &amp; Jerry.
- Unescape only understands &, <, >, " and '. References such as , ©, ' and ' stay exactly as written.
- Unescape decodes in a single pass, so &lt; becomes < and not <.
- Escaping for an HTML body does not cover every context. URLs, inline scripts and CSS need their own encoding, which the OWASP cheat sheet describes separately.
Practical tips
- Escape the raw text once, at the point where it is placed into HTML, and keep stored values unescaped.
- Quotes are escaped even though they are harmless in element text; they matter inside attribute values.
Privacy and security
This tool runs entirely in your browser. Your input is never uploaded to our servers. Escaping runs locally. It is output encoding, not a sanitizer: it does not remove or validate markup, and it does not make untrusted data safe inside a script, style or URL context.
References
- HTML Standard: Character references
- OWASP Cross Site Scripting Prevention Cheat Sheet
- MDN: Character reference
Frequently asked questions
Which characters does HTML Escape change?
Only &, <, >, double quotes and single quotes. The single quote becomes '.
Does Unescape decode every named entity?
No. It decodes the five references that Escape produces. Others, such as or ©, are left as they are.
Is HTML escaping the same as sanitizing HTML?
No. Escaping makes markup display as text. Sanitizing removes or rewrites unwanted markup, which this tool does not do.