HTML Entity Reference: Named, Decimal, and Hex Formats
What Are HTML Entity Formats?
HTML entities represent special characters using code sequences instead of the literal character. Three formats exist — named, decimal numeric, and hexadecimal numeric — and each serves a different purpose.
All three formats produce the same result. Choosing the right one depends on readability, compatibility, and the character you need.
Core Named Entities
These five named entities cover the characters that HTML itself reserves. You will use them constantly:
| Character | Named Entity | Decimal | Hex | Use Case |
|---|---|---|---|---|
& | & | & | & | Any time & appears as data |
< | < | < | < | Less-than sign in text |
> | > | > | > | Greater-than sign in text |
" | " | " | " | Quotes inside attribute values |
' | ' | ' | ' | Apostrophes inside attribute values |
Rule: Encode these five characters every time they appear as data inside HTML. Failing to do so can break your markup or open XSS vulnerabilities.
Common Symbols
| Character | Named Entity | Decimal | Hex | Description |
|---|---|---|---|---|
| © | © | © | © | Copyright |
| ® | ® | ® | ® | Registered trademark |
| ™ | ™ | ™ | ™ | Trademark |
| € | € | € | € | Euro |
| £ | £ | £ | £ | Pound sterling |
| ¥ | ¥ | ¥ | ¥ | Yen |
| ° | ° | ° | ° | Degree |
| ± | ± | ± | ± | Plus-minus |
| × | × | × | × | Multiplication |
| ÷ | ÷ | ÷ | ÷ | Division |
| — | — | — | — | Em dash |
| – | – | – | – | En dash |
| « | « | « | « | Left angle quote |
| » | » | » | » | Right angle quote |
|   |   | Non-breaking space |
Numeric Entities Explained
Decimal format
Decimal entities use the character's Unicode code point in base 10:
<p>Copyright © 2026</p>
<!-- Renders: Copyright © 2026 -->
The decimal value matches the number you find in Unicode charts — U+00A9 has decimal value 169.
Hexadecimal format
Hex entities use the code point in base 16, prefixed with x:
<p>Copyright © 2026</p>
<!-- Renders: Copyright © 2026 -->
Hex format maps directly to the standard Unicode notation. U+00A9 becomes © — you simply drop the U+ prefix and add &#x ... ;.
When numeric is your only option
Most characters beyond the common symbols lack named entities:
| Character | Named | Decimal | Hex | Description |
|---|---|---|---|---|
| ≠ | — | ≠ | ≠ | Not equal |
| ≤ | — | ≤ | ≤ | Less than or equal |
| ≥ | — | ≥ | ≥ | Greater than or equal |
| → | — | → | → | Right arrow |
| ← | — | ← | ← | Left arrow |
| ₹ | — | ₹ | ₹ | Indian rupee |
| ₽ | — | ₽ | ₽ | Russian ruble |
| … | — | … | … | Ellipsis |
If a character has no named entity, use decimal or hex. Both work identically in all modern browsers.
When to Use Which Format
| Context | Best Format | Reason |
|---|---|---|
Core five (& < > " ') | Named | Most readable, universally understood |
| Common symbols (©, €, —) | Named | Self-documenting in source code |
| Rare symbols, math, arrows | Decimal or hex | No named entity exists |
| Email templates | Decimal | Most reliable across email clients |
| XML documents | Named (limited) or decimal | XML supports only 5 named entities |
| Dynamic output from JavaScript | Hex | Matches Unicode escape syntax (\uXXXX) |
Readability comparison
<!-- Same character, three formats -->
<p>Price: €49</p>
<p>Price: €49</p>
<p>Price: €49</p>
All three render identically, but the named version communicates intent fastest when reading source code.
Compatibility Notes
- HTML4 supports roughly 250 named entities. HTML5 expanded this to over 2,000.
- XML recognizes only five named entities:
&,<,>,",'. Use numeric entities for everything else in XML. 'was invalid in HTML4 but works in HTML5 and XML. Use'for maximum compatibility.- Numeric entities work everywhere — HTML4, HTML5, XML, XHTML, and all browsers.
- UTF-8 documents can often display characters directly without entities, but you still need entities for the core five to avoid parsing conflicts.
Character Sets and Encoding
Your document's character encoding determines how the browser interprets bytes before entity resolution occurs.
<!-- Always declare UTF-8 in your HTML -->
<meta charset="utf-8">
With UTF-8, you can safely paste most characters directly: ©, €, —. However, the characters <, >, &, ", and ' still require entities when they appear as data — your charset does not change their structural meaning in HTML.
Key Takeaways
- Three entity formats exist: named (
&), decimal (&), and hexadecimal (&) - Encode the core five characters (
& < > " ') every time they appear as data - Named entities improve source readability; numeric entities offer full Unicode coverage
- Use decimal entities for email templates and XML where named support is limited
- UTF-8 charset lets you write most characters directly, but reserved characters always need entities
- Always include the semicolon — omitting it creates parser ambiguity
Related Guides
Try It Yourself
Look up, encode, and decode HTML entities instantly with our free HTML Encoder/Decoder tool. Search by character or entity name and get all three formats at once.