HTML Escape / Unescape
Escape or unescape HTML entities including named, decimal, and hex numeric entities.
HTML Entity Reference
| Character | HTML Entity | Named Entity |
|---|---|---|
| & | & | ampersand |
| < | < | less-than |
| > | > | greater-than |
| " | " | double quote |
| ' | ' | single quote |
| | non-breaking space | |
| © | © | copyright |
| ® | ® | registered |
| ™ | ™ | trademark |
Where HTML Escaping Matters Most
- ▸Rendering user-generated content — Comments, reviews, usernames and bios must be escaped before insertion into HTML, or a name like <script>alert(1)</script> becomes executable code.
- ▸Displaying code samples — A tutorial showing <div> or & in a <pre> block needs escaping, or the browser tries to parse it as real markup instead of showing it as text.
- ▸Building HTML email templates — Email clients render raw HTML — unescaped user data in a template is as risky as it is in a web page.
- ▸Server-side templating without auto-escaping — Some template engines and raw string concatenation don't escape by default — this tool lets you verify the escaped output before shipping it.
When to Escape HTML
| Context | Required | Reason |
|---|---|---|
| User-generated content in HTML | Yes | Prevents XSS attacks |
| Code samples in <pre> blocks | Yes | Angle brackets would close tags |
| Attribute values | Yes | Quotes can break attributes |
| JSON in HTML <script> | Partial | Escape </script> closing tag |
| Template literals in JS | No | Use JS string escaping instead |