AZ Tools

HTML Entity Encoder / Decoder

Developer

Escape text safely for use in HTML, or recover the original text from an entity-encoded string. Pick between minimal escaping (only the dangerous five — & < > " ') and full escaping of every non-ASCII character, and choose named (&amp;), decimal (&#38;), or hex (&#x26;) entity output. Decoding accepts all three forms in one pass.

Output
&lt;div class=&quot;hello&quot;&gt;Tom &amp; Jerry — &quot;café&quot; © 2026&lt;/div&gt;

How to use

  1. Pick Encode or Decode.
  2. For encoding, choose minimal vs all non-ASCII, and named / decimal / hex.
  3. Paste your text — the result updates as you type.
  4. Swap reuses the output as the next input.

Frequently asked questions

When should I use 'minimal' vs 'all non-ASCII'?
Minimal is right for almost every HTML context — UTF-8 pages render é, 한, 中 etc. directly, so only the five characters that confuse the HTML parser need to be escaped. Use 'all non-ASCII' when the destination must stay in pure ASCII (e.g., legacy email templates).
Named vs numeric entities — which is best?
Named entities (&copy;) are easier to read, decimal (&#169;) and hex (&#xa9;) work for any code point even if no name exists. All three decode the same.
Does decoding handle &#xNN; and &#NN;?
Yes. The decoder accepts named, decimal, and hex forms in a single pass.
Are emoji and supplementary characters supported?
Yes — encoding uses code points, so characters outside the BMP (😀, 𝕏, etc.) encode and decode correctly.

Related tools