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.
Most used HTML entities
| Character | Named | Numeric |
|---|---|---|
| & | & | & |
| < | < | < |
| > | > | > |
| " | " | " |
| ' | ' | ' |
| (nbsp) | |   |
| © | © | © |
| ® | ® | ® |
| ™ | ™ | ™ |
| € | € | € |
| £ | £ | £ |
| ° | ° | ° |
| ± | ± | ± |
| × | × | × |
| ÷ | ÷ | ÷ |
| … | … | … |
| – | – | – |
| — | — | — |
| « | « | « |
| » | » | » |
| “ | “ | “ |
| ” | ” | ” |
| • | • | • |
| → | → | → |
| á | á | á |
| é | é | é |
| ñ | ñ | ñ |
| Ñ | Ñ | Ñ |
| ü | ü | ü |
| ç | ç | ç |
| ¿ | ¿ | ¿ |
| ¡ | ¡ | ¡ |
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 © for ©, or numeric, using the character's Unicode number in decimal (©) or hexadecimal (©).
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.