Encode and decode HTML entities

Escape the special characters in a text so you can put it into HTML without breaking the page, or convert HTML entities back into plain text.

HTML entities

When encoding:

Most used HTML entities

CharacterNamedNumeric
& & &
< &lt; &#60;
> &gt; &#62;
" &quot; &#34;
' &apos; &#39;
(nbsp) &nbsp; &#160;
© &copy; &#169;
® &reg; &#174;
™ &trade; &#8482;
€ &euro; &#8364;
£ &pound; &#163;
° &deg; &#176;
± &plusmn; &#177;
× &times; &#215;
÷ &divide; &#247;
… &hellip; &#8230;
– &ndash; &#8211;
— &mdash; &#8212;
« &laquo; &#171;
» &raquo; &#187;
“ &ldquo; &#8220;
” &rdquo; &#8221;
• &bull; &#8226;
→ &rarr; &#8594;
á &aacute; &#225;
é &eacute; &#233;
ñ &ntilde; &#241;
Ñ &Ntilde; &#209;
ü &uuml; &#252;
ç &ccedil; &#231;
¿ &iquest; &#191;
¡ &iexcl; &#161;

What are HTML entities?

An HTML entity is a way of writing a character with a code that starts with & and ends with ;. It can be named, like &copy; for ©, or numeric, using the character's Unicode number in decimal (&#169;) or hexadecimal (&#xA9;).

When should you use them?

You must always escape the characters that have a special meaning in HTML: < and > (they open and close tags), & (it starts an entity) and quotes inside attributes. Otherwise the browser treats them as code: the page layout breaks and, if the text comes from a user, you open the door to XSS attacks.

Accented letters or emojis do not need entities if the page uses UTF-8, which is the norm today. They are only useful when the file has to be pure ASCII, for example in some emails or legacy systems.