HTML Entity Encoder

Escape and unescape HTML entities

Runs in your browserUtility03Encoding & Crypto

What is HTML Entity Encoder?

This HTML entity tool converts characters such as &, <, >, and " into their entity form so that content cannot break the surrounding markup or open an injection hole, and reverses entities back into readable text. You can optionally escape every non-ASCII character as a numeric entity. Conversion happens locally.

How to use HTML Entity Encoder

  1. 1Choose escape or unescape.
  2. 2Paste your content and the result is generated instantly.
  3. 3Enable "escape all non-ASCII" when the content has to travel through an ASCII-only channel.

Frequently asked questions

Does HTML escaping prevent XSS?+

Escaping those five characters is effective baseline protection when you insert untrusted content into an HTML text node. The rules differ once you interpolate into an attribute, a URL, CSS, or JavaScript, so each of those contexts needs its own encoding — or better, use your framework safe binding and let it handle the context for you.

Why must & be escaped first?+

Because every other entity starts with &. If you turn < into &lt; before escaping ampersands, that ampersand gets escaped too and you end up with the double-escaped &amp;lt;. This tool already applies the correct order.

Related tools

All tools