HTML Entities: What They Are and How to Use Them
Struggling with < and > showing up as raw HTML? Here's how HTML entities work and a free tool to encode/decode them instantly.
HTML entities are special codes used to represent characters that have reserved meanings in HTML or characters that cannot be typed on a standard keyboard.
What Are HTML Entities?
HTML entities start with an ampersand (&) and end with a semicolon (;). They represent characters that would otherwise be interpreted as HTML markup:
| Character | Entity | Description |
|---|---|---|
| < | < | Less than |
| > | > | Greater than |
| & | & | Ampersand |
| " | " | Double quote |
| ' | ' | Single quote |
| Non-breaking space | |
| © | © | Copyright |
| ® | ® | Registered trademark |
| € | € | Euro sign |
| £ | £ | Pound sign |
When to Use HTML Entities
1. Reserved Characters
<!-- Wrong -->
<!-- Right -->
<p>5 < 10 and 10 > 5</p>
`
2. Special Symbols
<p>Price: €50 or £40</p>
<p>Copyright © 2025</p>
3. Invisible Characters
<p>100 km/h</p>
Numeric Entities
You can also use numeric codes:
| Character | Decimal | Hexadecimal |
|---|---|---|
| A | A | A |
| © | © | © |
| € | € | € |
Common Mistakes
- Forgetting the semicolon —
<instead of< - Double encoding —
&lt;instead of< - Encoding in attributes —
title="5 < 10"is correct - Not encoding in code blocks — Inside
<pre>and<code>, entities are still interpreted
Try It Online
## Common HTML Entities
&→&(ampersand — must be encoded in attributes and text)<→<(less than — must be encoded to avoid being parsed as a tag)>→>(greater than — technically optional but recommended)"→"(double quote — must be encoded in attribute values delimited by double quotes)'or'→'(single quote — must be encoded in single-quoted attributes) → non-breaking space (prevents line breaks at this point)©→©(copyright symbol)®→®(registered trademark)™→™(trademark)—→—(em dash)–→–(en dash)…→…(ellipsis)
Numeric vs Named Entities
HTML entities come in two forms:
- Named entities:
&,©, . Easy to read and remember, but only a limited set is defined. - Numeric entities:
&(decimal) or&(hexadecimal) for&. Can represent any Unicode character.
For characters without named entities (like emojis or rare Unicode symbols), use numeric entities. For example, the copyright symbol can be written as ©, ©, or © — all three are equivalent.
When to Use HTML Entities
- In HTML text content: Encode
&,<, and>to avoid parsing issues. - In attribute values: Encode
&,<,>, and the matching quote character. - In JavaScript strings: Use
\uescapes or direct UTF-8 characters instead of HTML entities. - In URLs: Use percent encoding (
%20for space), not HTML entities. - In CSS: Use CSS escape sequences (\
\for backslash) or direct UTF-8 characters.
Modern HTML5 with UTF-8 encoding rarely needs entities for special characters — you can type © directly. But &, <, and > must always be encoded in HTML.
Use our free HTML entities encoder/decoder to encode or decode HTML entities instantly — no installation needed.