HTML Entities & Character References
HTML character references (commonly called HTML entities) represent characters in HTML markup using predefined mnemonic names or numeric Unicode code points. Named references exist for a finite, authoritative set of 2,125 canonical characters defined by the WHATWG HTML Living Standard, while numeric decimal (&#[dec];) and hexadecimal (&#x[hex];) references can represent any valid Unicode scalar value. Use character references to safely escape syntax-sensitive delimiters (&, <, >, ", ') or specify characters when source encoding is constrained.
Common HTML Entities & Developer Quick Reference
The most frequently used HTML character references for web development, typography, mathematical formulas, and currency symbols. Click any code format to instantly copy it to your clipboard.
Syntax-Sensitive Characters & Context-Aware Escaping
HTML defines five reserved delimiter characters that trigger parser state changes: & (entity introducer), < (tag opener), > (tag closer), " (attribute delimiter), and ' (attribute delimiter). Escaping these characters is essential to prevent parsing ambiguity and Cross-Site Scripting (XSS) vulnerabilities. Whether escaping is mandatory depends strictly on the parsing context.
| Char | Named Entity | Decimal | Hex | Unicode | Why Escaped & Parsing Risk |
|---|---|---|---|---|---|
U+0026
|
|||||
U+003C
|
|||||
U+003E
|
|||||
U+0022
|
|||||
U+0027
|
Context-Dependent Escaping Requirements
The HTML specification establishes different escaping constraints depending on where the character appears in the document object model:
HTML Text Content
Inside standard HTML element body text (e.g. paragraphs, spans, headings):
- & → Must be escaped as
&to prevent unintended entity parsing. - < → Must be escaped as
<to prevent interpreting subsequent text as a new tag name. - > → Recommended as
>, though technically allowed unless preceded by two hyphens or closing markup. - " and ' → Safe without escaping in body text.
Double-Quoted Attributes
Inside double-quoted attribute values (e.g. title="...", href="..."):
- " → Must be escaped as
"(prematurely terminates attribute value if unescaped). - & → Must be escaped as
&when followed by a name character or hash. - < and > → Safe inside quotes, but escaping is recommended for consistency.
- ' → Safe without escaping inside double quotes.
Single-Quoted Attributes
Inside single-quoted attribute values (e.g. title='...'):
- ' → Must be escaped as
'or'(prematurely terminates attribute value if unescaped). - & → Must be escaped as
&. - " → Safe without escaping inside single quotes.
- < and > → Safe inside quotes, recommended to escape.
Unquoted Attributes (Dangerous)
In unquoted attributes (e.g. class=main):
- Spaces, tabs, newlines → Strictly prohibited (breaks tokenization).
- " ' = < > ` & → Must all be strictly escaped or avoided.
- Best Practice: Always quote all HTML attribute values with double quotes. Never use unquoted attributes for dynamic content.
HTML Character References Directory
Authoritative, standards-compliant directory of all 2,125 canonical WHATWG named character references alongside their exact decimal (&#[dec];) and hexadecimal (&#x[hex];) numeric representations. Click any value to copy to clipboard.
| Char | Named Reference | Decimal Code | Hexadecimal Code | Code Point | Category | Copy |
|---|---|---|---|---|---|---|
| Æ |
|
Symbols | ||||
| & |
|
Common | ||||
| Á |
|
Symbols | ||||
| Ă |
|
Symbols | ||||
| Â |
|
Symbols | ||||
| А |
|
Symbols | ||||
| 𝔄 |
|
Symbols | ||||
| À |
|
Symbols | ||||
| Α |
|
Greek | ||||
| Ā |
|
Symbols | ||||
| ⩓ |
|
Math | ||||
| Ą |
|
Symbols | ||||
| 𝔸 |
|
Symbols | ||||
| |
|
Symbols | ||||
| Å |
|
Symbols | ||||
| 𝒜 |
|
Symbols | ||||
| ≔ |
|
Math | ||||
| Ã |
|
Symbols | ||||
| Ä |
|
Symbols | ||||
| ∖ |
|
Math | ||||
| ⫧ |
|
Math | ||||
| ⌆ |
|
Symbols | ||||
| Б |
|
Symbols | ||||
| ∵ |
|
Math | ||||
| ℬ |
|
Symbols | ||||
| Β |
|
Greek | ||||
| 𝔅 |
|
Symbols | ||||
| 𝔹 |
|
Symbols | ||||
| ˘ |
|
Symbols | ||||
| ℬ |
|
Symbols | ||||
| ≎ |
|
Math | ||||
| Ч |
|
Symbols | ||||
| © |
|
Common | ||||
| Ć |
|
Symbols | ||||
| ⋒ |
|
Math | ||||
| ⅅ |
|
Symbols | ||||
| ℭ |
|
Symbols | ||||
| Č |
|
Symbols | ||||
| Ç |
|
Symbols | ||||
| Ĉ |
|
Symbols | ||||
| ∰ |
|
Math | ||||
| Ċ |
|
Symbols | ||||
| ¸ |
|
Symbols | ||||
| · |
|
Symbols | ||||
| ℭ |
|
Symbols | ||||
| Χ |
|
Greek | ||||
| ⊙ |
|
Math | ||||
| ⊖ |
|
Math | ||||
| ⊕ |
|
Math | ||||
| ⊗ |
|
Math |
Named References vs Numeric Codes (Decimal & Hex)
HTML provides three distinct syntaxes for referencing characters: mnemonic Named References, base-10 Decimal References, and base-16 Hexadecimal References. Understanding the capabilities and boundaries of each format is critical for modern web engineering.
| Char | Character Name | Named Reference | Decimal Reference | Hexadecimal Reference | Code Point |
|---|---|---|---|---|---|
| Copyright Sign |
|
||||
| Ampersand |
|
||||
| Euro Sign |
|
||||
| Grinning Face (No named entity) | None (Numeric only) |
|
Named Character References
Syntax: &[name]; (e.g. ©, &)
- Finite Vocabulary: Exactly 2,125 canonical names exist in the WHATWG specification. No other named entities are valid.
- Strict Case Sensitivity: Character names are case-sensitive.
Ε(Ε) produces Greek capital letter Epsilon (U+0395), whereasε(ε) produces Greek small letter epsilon (U+03B5). - Readability: Highly mnemonic and easy for humans to read and audit in source templates.
- Emoji Limitation: Modern emojis (such as 😀 U+1F600 or ❤️ U+2764) have zero named references. Trying to write
&grinning;or&heart;will render verbatim as broken text.
Decimal Numeric References
Syntax: &#[decimal]; (e.g. ©, €)
- Full Unicode Coverage: Can represent any of the 1,112,064 Unicode scalar values (U+0000 to U+10FFFF, excluding surrogates U+D800..U+DFFF).
- Universal Parser Support: Supported by 100% of HTML, XML, SVG, and SGML parsers without requiring external entity catalogs or DTDs.
- Base-10 Conversion: Requires converting hexadecimal Unicode codepoints to decimal (e.g. U+20AC → 8364).
- Legacy Windows-1252 Pitfall: In older SGML/HTML 4 documents, numbers 128–159 were often used for Windows-1252 characters (e.g.
€for €). Modern HTML5 parsers automatically re-map these control points, but standard authors should use the true Unicode codepoints (e.g.€).
Hexadecimal Numeric References
Syntax: &#x[hex]; or &#X[hex]; (e.g. ©, €)
- Direct Unicode Alignment: Directly maps to Unicode code points without mathematical conversion (e.g. U+20AC →
€). - Preferred for Developer Tooling: Because Unicode specifications, font tables, and IDEs reference characters by hex (U+XXXX), hexadecimal references reduce cognitive load and conversion bugs.
- Case Insensitive 'x' and Digits: The leading indicator can be
xorX, and hex digitsa-forA-Fare parsed equivalently by compliant user agents. - Leading Zeros Optional:
A,A, andAall evaluate to 'A' (U+0041).
Multi-Codepoint Entity Sequences (The 93 Compound References)
A common misconception among software engineers is that every HTML named reference maps to exactly one Unicode code point. In reality, the WHATWG HTML Living Standard defines exactly 93 named character references that expand into sequences of two distinct Unicode code points.
How HTML Parsers Process Compound Sequences
When an HTML5-compliant tokenizer encounters a named entity like ≂̸, the named character reference state matches the full string and emits two distinct Unicode scalar values: U+2242 (Asymptotically Equal To) immediately followed by U+0338 (Combining Long Solidus Overlay).
| Char | Named Reference | Unicode Codepoint Sequence | Compound Decimal Code | Compound Hexadecimal Code |
|---|---|---|---|---|
| ≂̸ | ≂̸ |
U+2242 U+0338 |
≂̸ |
≂̸ |
| =⃥ | =⃥ |
U+003D U+20E5 |
=⃥ |
=⃥ |
| ∩︀ | ∩︀ |
U+2229 U+FE00 |
∩︀ |
∩︀ |
| ≡⃥ | ⪈ |
U+2265 U+0338 |
≱ |
≱ |
| ≤⃥ | ⪇ |
U+2264 U+0338 |
≰ |
≰ |
Critical Engineering Implications:
An HTML numeric entity syntax (&#[dec];) accepts only a single integer scalar value. To represent a multi-codepoint named entity numerically, you must concatenate two adjacent numeric references (e.g. ≂̸).
In JavaScript, C#, and Java, compound sequences may comprise 2 or 3 16-bit code units (especially if combining with surrogate pairs). Always use Array.from(str) or Unicode-aware iterators rather than str.length to measure character counts.
Most compound references pair a base mathematical operator or symbol with a combining diacritical mark (such as U+0338 Combining Long Solidus Overlay). Modern font rendering engines (HarfBuzz, DirectWrite, CoreText) shape them into a single visual glyph.
Best Practices: Direct UTF-8 Authoring vs Character Escaping
In modern web engineering, when should you write raw Unicode characters directly, and when must you use HTML character references? Following standards-based guidelines prevents source code bloat, improves maintainability, and eliminates security vulnerabilities.
Direct UTF-8 Authoring (Standard Practice)
Every modern HTML document should begin with <meta charset="utf-8">. When UTF-8 is active, you should write native characters directly into your templates:
<p>© 2026 CopyCharacter. All rights reserved. Price: €19.99</p>
<p>© 2026 CopyCharacter. All rights reserved. Price: €19.99</p>
- Smaller Payload: Raw UTF-8 bytes take less bandwidth than 6–8 byte entity strings (e.g.
€is 3 bytes in UTF-8 vs 6 bytes for€or 8 bytes for€). - Developer Ergonomics: International text in French, Spanish, Arabic, Japanese, or German remains naturally readable without mental translation.
- Full Unicode Support: Emojis and regional symbols are natively supported.
When Character References ARE Mandatory
Character references are strictly necessary in four specific scenarios:
-
Syntax Delimiters: Raw
&,<, and>in text content, or quotes (",') inside matching attribute values. -
Invisible / Non-Printing Characters: Non-breaking space (
), zero-width non-joiner (‌), and zero-width joiner (‍). Writing these raw can lead to accidental deletion or re-formatting by IDE linters, minifiers, and code formatters. -
Ambiguous Glyphs: Characters that are visually indistinguishable from ASCII characters (e.g. Greek question mark
?/;vs semicolon;, or Cyrillic small letter 'a' vs Latin 'a'). - ASCII-Restricted Environments: Legacy 7-bit SMTP email transport, legacy SGML tools, or systems unable to process multi-byte UTF-8 streams.
The Semicolonless Entity Trap & URL Corruption
WHATWG Historical Quirk
The WHATWG HTML Living Standard documents 106 legacy named entities that historically allowed omitting the trailing semicolon (e.g. &, ©, >, <, ", ®). This exists solely for backwards compatibility with broken 1990s web pages.
<a href="search.php?category=books©=true">View Books</a>
search.php?category=books©=true ← Parameter key corrupted to copyright glyph!
<a href="search.php?category=books&copy=true">View Books</a>
Batch HTML Entity Encoder & Decoder
Need to encode entire documents, sanitize user inputs, or decode obfuscated HTML entities back to raw UTF-8 text? Use CopyCharacter's free online HTML Entity Encoder. Convert instantly with options for named entities, decimal codes (&#[dec];), or hexadecimal codes (&#x[hex];).
Standards Compliance & Dataset Provenance
Every character reference, codepoint mapping, and parser behavior documented on this page is directly derived from the official specifications maintained by the Web Hypertext Application Technology Working Group (WHATWG), the World Wide Web Consortium (W3C), and the Unicode Consortium.
00289ceb64acb3071f854c90e80c72f519bb2c3af5e8801f2e60468637cd911f
Normative Citations:
- WHATWG HTML Living Standard §13.5 Named character references — https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references. The definitive authority on valid named character references, parser tokenizer states, and consume character reference algorithms.
- W3C Recommendation: HTML 5.2 §8.1.4 Character references — https://www.w3.org/TR/html52/syntax.html#character-references. Details decimal numeric, hexadecimal numeric, and named character reference syntax rules.
- The Unicode Consortium: The Unicode Standard, Version 17.0 — Chapter 3 Conformance establishes the validity of Unicode scalar values (U+0000..U+D7FF and U+E000..U+10FFFF) and surrogate boundary prohibitions.