DEVELOPER / BROWSER TOOL

HTML entity encoder and decoder

Encode or decode common HTML entities.

Processed on your device · no account needed
Your inputStays on your device
Supports amp, lt, gt, quot, apos and valid numeric entities. Output stays text.
Result

Your result will appear here.

Enter your input, then run the tool.

How to use the html entity encoder and decoder

Turn characters such as < and & into HTML entities, or turn supported entities back into characters.

Paste text, choose encode or decode, and copy or download the result.

  1. Paste text or HTML into Input.
  2. Set Mode to encode (the default) or decode.
  3. Press Run tool.
  4. Use Copy result, or download the output as hth-html-entities.txt.

Good to know

  • Encoding covers &, <, >, double quotes and apostrophes.
  • Decoding covers amp, lt, gt, quot, apos and valid decimal or hexadecimal numeric entities.
  • Unknown entities and invalid Unicode numbers are left as written.
  • Input is limited to 500,000 characters and processed in your browser.

Examples

  • Encode <a href="x">Tom & Jerry</a> → &lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;.
  • Encode it's → it&apos;s.
  • Decode &#169; &#xA9; &copy; → © © &copy;. Numeric forms work, but copy isn’t one of the five supported names.

If something goes wrong

&copy;, &nbsp; or &eacute; stay unchanged after decoding.

Only amp, lt, gt, quot and apos are decoded by name. Use the numeric form instead, such as &#169; or &#160;.

&amp;lt; decodes to &lt; instead of <.

Decoding is a single pass, so double-encoded text needs a second run. Paste the result back in and decode again.

&amp without a semicolon isn’t decoded.

An entity must end with a semicolon. Add it and run again.

Questions

Will it encode every character?

No. It encodes five characters that have special use in HTML.

Will it run HTML?

No. The result is displayed as text.

What happens to an unknown entity?

It remains unchanged in decode mode.

Are entity names case-sensitive here?

No. &LT; and &AMP; decode the same as &lt; and &amp;.

Does encoding change accented letters or emoji?

No. They’re left as they are, which is fine on a UTF-8 page. Only the five special characters are replaced.

Background reading: Base64, URL encoding and HTML entities: which one do you need?

Next steps: Text to HTML · Markdown to HTML · URL encoder and decoder

Keep going