Avexora Free Tools

HTML Entity Encoder / Decoder

Escape text for HTML, or decode &-style entities back to characters.

About the HTML Entity Encoder / Decoder

HTML gives special meaning to a handful of characters: < opens a tag, & starts an entity, quotes delimit attributes. Put raw user text or code containing those characters into a page and the browser misreads it — content disappears into imaginary tags, layouts break, and in the worst case injected script runs. The fix is entity encoding: < becomes &lt;, & becomes &amp;, and the browser displays the characters instead of interpreting them. This tool encodes text for safe embedding, and decodes entity-riddled text back to readable characters.

Encoding here covers the five structurally dangerous characters (&, <, >, double and single quotes) plus any character outside printable ASCII, which is emitted as a numeric entity — handy when your file might travel through systems that mangle UTF-8. Decoding understands the common named entities (&amp;, &lt;, &gt;, &quot;, &apos;, &nbsp;) as well as decimal (&#8377;) and hex (&#x20B9;) numeric forms, so text copied out of HTML source, RSS feeds or scraped pages turns back into normal prose.

Everyday jobs: embedding a code snippet in a blog post so if (a < b) displays literally; putting a company name like "R&D Labs" into an HTML attribute; cleaning up an exported document where every rupee sign arrived as &#8377;. One caution — entity encoding output is for HTML contexts. It is not sufficient escaping for JavaScript strings, URLs or SQL; each context has its own rules (the URL encoder next door handles that case).

Frequently asked questions

Which characters must be escaped in HTML?
At minimum & and < in content, plus quotes inside attribute values. This encoder handles all five dangerous characters and non-ASCII text, which is always safe to over-escape.
What's the difference between &#8377; and &#x20B9;?
The same character (₹) referenced by decimal vs hexadecimal code point. Both are valid; the decoder accepts both plus common named entities.
Does encoding protect against XSS?
Entity-encoding untrusted text before inserting it into HTML content is a core XSS defence, but the escaping must match the context — attribute, URL and JavaScript contexts each need their own rules. Use a templating engine's auto-escaping where possible.

Get one practical business tip every week

Tools, templates and tactics for running your business — free, no spam.

Related tools

More developer & web utilities