navaja.dev / html-entities

HTML entity encoder and decoder

Type in the Text box to escape it for HTML, or paste HTML with entities into the HTML box to decode it. Both update as you type.

How to encode and decode HTML entities

Common HTML entities

CharacterNamedNumericName
&&&Ampersand
<&lt;&#60;Less than
>&gt;&#62;Greater than
"&quot;&#34;Double quote
'&apos;&#39;Apostrophe
(space)&nbsp;&#160;Non-breaking space
©&copy;&#169;Copyright
®&reg;&#174;Registered
™&trade;&#8482;Trademark
€&euro;&#8364;Euro
—&mdash;&#8212;Em dash
…&hellip;&#8230;Ellipsis
→&rarr;&#8594;Right arrow
×&times;&#215;Multiplication

Why escape HTML?

Text placed into a page without escaping can break the layout, or let someone inject a script (XSS). Escaping <, >, & and quotes makes the browser show them as characters instead of reading them as markup.

Questions

Which characters must be escaped in HTML?

& and < in text; & and the quote you use in attribute values. Escaping & < > " ' everywhere, as Minimal does, is always safe.

What's the difference between &#39; and &apos;?

Both are an apostrophe. &apos; is not defined in HTML 4, so &#39; is used here because it works everywhere, including old email clients.

Should I encode accents like é as &eacute;?

Not on a UTF-8 page: just write é. Named or numeric entities help only when the output must be pure ASCII.

How do I fix &amp; showing on my page?

The text was escaped twice. Paste it into the HTML box with Decode repeatedly ticked, then escape it once.

Does it decode every entity?

Yes. All 2,231 HTML5 names (including legacy ones without a semicolon, like &copy) plus every decimal and hex reference, the same way browsers do.

Is this safe to use with untrusted HTML?

Decoding only reads entities; tags in your input are never rendered or run, and nothing is sent anywhere.