How to Use the HTML Entity Encoder
- Paste or enter your input into the text field.
- Configure any options (format, delimiter, encoding, or mode) using the controls above the output.
- The result updates instantly — no submit button required for most operations.
- Click Copy or Download to take the output to your next step.
Paste your text and the encoder replaces HTML-significant characters (& < > ' ") with their entity equivalents, plus optionally encodes every non-ASCII character as a numeric entity for maximum compatibility. Choose 'minimal' to escape only the five HTML-significant characters (the safe-to-render set), or 'all non-ASCII' to encode every character above U+007F.
How the HTML Entity Encoder Works
The decoder recognises the five built-in named entities (& < > " ') plus the full HTML5 named-entity list, plus decimal (&) and hexadecimal (&) numeric references. This is the right way to defang user-supplied text before injecting it into HTML, but for full XSS protection use a templating engine that escapes by default.
- Named or numeric entity output
- Encodes the five HTML-significant chars at minimum
- Decoder accepts named, decimal and hex entities
- Bidirectional encode/decode
- Helpful for HTML escape and email signatures
Frequently Asked Questions
Should I use named entities like & or numeric like &?
Named entities are more readable; numeric entities work even when the named entity isn't recognised. For HTML5 either works. For XML, only the five built-in named entities are universally safe — use numeric for everything else.
Does encoding everything protect against XSS?
Encoding the five HTML-significant characters (& < > " ') prevents text from being interpreted as markup, which is the foundation of XSS prevention. But always use a templating engine that escapes by default — relying on a manual pass is risky.
What's the difference between ' and '?
Both represent the apostrophe ('). ' is HTML5 / XML; in HTML4 only ' (numeric) was guaranteed to work. Modern browsers accept both.
Can the decoder handle hex entities like 🎉?
Yes — hexadecimal numeric character references with the &#x prefix are decoded correctly. 🎉 decodes to 🎉.
Explore the full suite of ENCODERS tools and 290+ other free utilities at Chunky Munster.