What Are HTML Entities?
HTML entities are special codes that represent characters which cannot be directly typed or would otherwise be interpreted as HTML syntax. According to MDN Web Docs, an entity is a reference to information that can be defined once and used throughout a document in SGML terminology. In HTML specifically, entities enable you to display reserved characters, special symbols, and characters from various languages.
The entity syntax follows a consistent pattern: an ampersand (&) followed by either a name or number, then a semicolon (;). For example, < renders as < and © displays the copyright symbol (©).
Why Entities Exist
HTML has several characters that serve as syntax markers. The angle brackets < and > indicate the start and end of HTML tags. The ampersand (&) introduces special codes. When you want these characters to appear as visible text rather than functioning as code, you must use their entity representations, as explained in Elementor's HTML entities guide.
Beyond escaping reserved characters, entities unlock access to thousands of symbols, mathematical operators, currency signs, and international characters that aren't available on standard keyboards. This capability is essential for creating professional, globally accessible web content through proper web development practices.
Key Takeaway
Entities ensure your HTML renders correctly and enable access to special symbols that enhance professional presentation. When building websites that rank well in search results, proper character encoding prevents indexing issues caused by malformed HTML.
Quick navigation
What Are HTML Entities?
Understanding entity basics
Types of Entities
Named, decimal & hexadecimal
Reserved Characters
Essential escaping guide
Common Categories
Symbols, math & Greek letters
Best Practices
Modern entity usage
Accessibility
Screen reader considerations
Types of HTML Entities
HTML entities come in three formats, all producing identical results. Choose based on readability and context.
Named Entities
Named entities use descriptive words between the ampersand and semicolon. They are the most readable option and should be your default choice for common characters, as recommended by Elementor's HTML entities guide.
<!-- Reserved character escaping -->
< <!-- displays < -->
> <!-- displays > -->
& <!-- displays & -->
" <!-- displays " -->
<!-- Common symbols -->
© <!-- © -->
® <!-- ® -->
" <!-- displays " -->
Decimal Entities
Decimal entities use a number sign (#) followed by the decimal Unicode code point of the character, as documented in Elementor's guide.
< <!-- < (decimal 60) -->
> <!-- > (decimal 62) -->
& <!-- & (decimal 38) -->
Hexadecimal Entities
Hexadecimal entities use #x followed by the hexadecimal Unicode value, as shown in Elementor's documentation.
< <!-- < (hex 3C) -->
> <!-- > (hex 3E) -->
& <!-- & (hex 26) -->
All three formats produce identical results. Use named entities for readability with common characters, and decimal or hexadecimal entities when working with specific Unicode characters that lack named equivalents. Proper character encoding is a critical aspect of technical SEO that ensures search engines correctly parse and index your content.
| Character | Named Entity | Decimal | Hexadecimal | Use Case |
|---|---|---|---|---|
| < | < | < | < | Display literal less-than |
| > | > | > | > | Display literal greater-than |
| & | & | & | & | Display literal ampersand |
| " | " | " | " | Display quote in attribute |
| ' | ' | ' | ' | Display apostrophe |
| € | € | € | € | Euro currency symbol |
| GBP | £ | £ | £ | Pound currency symbol |
| ¥ | ¥ | ¥ | ¥ | Yen currency symbol |
The Ampersand Rule
The ampersand is the most frequently misused character. Every ampersand in your HTML content (outside of entity definitions themselves) should be written as &. This includes URLs in attributes, JavaScript code embedded in HTML, and any natural language text containing "AT&T" or similar, as emphasized by DhiWise's HTML entities article.
<!-- WRONG - will cause parsing errors -->
<p>Visit us at AT&T for more info</p>
<p>http://example.com?param1=value¶m2=test</p>
<!-- CORRECT - properly escaped -->
<p>Visit us at AT&T for more info</p>
<p>http://example.com?param1=value&param2=test</p>
The ampersand requires special attention because browsers interpret unescaped ampersands as the start of a new entity reference. When an unrecognized sequence follows, browsers may display unexpected characters or truncate content unexpectedly. Always using & prevents these parsing errors and ensures consistent rendering across all browsers and devices. This attention to detail is what separates amateur web development from professional-grade code that performs reliably in production environments.
Common Character Entity Categories
Symbols and Marks
These entities enable you to display legally required notices and professional typography, including copyright symbols, trademarks, and currency markers as documented by Elementor:
<p>© 2026 Company Name. All rights reserved.</p>
<p>® Registered Trademark</p>
<p>™ Trademark</p>
<p>Price: €99.99</p>
<p>Cost: £75.00</p>
Mathematical Operators
Common math symbols for educational content and technical documentation:
<p>5 × 3 = 15</p>
<p>100 ÷ 4 = 25</p>
<p>x ≤ 10</p>
<p>x ≥ 0</p>
<p>A ∈ B</p>
<p>π ≈ 3.14159</p>
Greek Letters
Greek letters used in math, science, and statistics contexts:
<p>Alpha: α</p>
<p>Beta: β</p>
<p>Gamma: γ</p>
<p>Delta: δ</p>
<p>Pi: π</p>
<p>Sigma: σ</p>
<p>Omega: ω</p>
Arrows
Directional and functional arrows for UI and navigation:
<p>← Back</p>
<p>Next →</p>
<p>↑ Top</p>
<p>↓ Expand</p>
<p>↔ Swap</p>
Typography and Punctuation
Professional typography distinguishes polished content, as noted in Elementor's typography guide:
<p>“Quoted text using smart quotes.”</p>
<p>Single quote: ‘inside’ content</p>
<p>Range: 10–20 pages</p>
<p>Break: This is a thought—continued.</p>
<p>Contact us…</p>
Non-Breaking Space
The non-breaking space ( ) prevents browsers from wrapping at that space. Use it between words that should stay together, as defined in the MDN character reference.
<p>Chapter 1</p>
<p>Fig. 5</p>
<p>$ 100.00</p>
Use cases:
- Chapter and figure references
- Currency symbols and amounts
- Names and titles
- Phone numbers
Don't overuse: Excessive non-breaking spaces can cause layout issues on narrow screens and impact accessibility on mobile devices.
Best Practices for Modern Web Development
UTF-8 Encoding
The most important practice is declaring UTF-8 encoding and using actual Unicode characters when your editor and font support them, as recommended by Elementor's HTML entities guide. Modern development environments handle UTF-8 natively, reducing the need for verbose entity references in your source code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- Use actual characters when your setup supports them -->
<p>© 2026 Company Name</p>
<p>5 × 3 = 15</p>
</html>
However, entities remain essential for:
- Reserved characters (
<,>,&) - Characters in source code or examples
- Environments without UTF-8 support
- Maximum compatibility across systems
When to Use Entities
| Situation | Recommendation |
|---|---|
| Reserved characters (<, >, &) | Always use entities |
| Characters in code examples | Always use entities |
| Common symbols (©, ®, ™) | Either (entities for safety) |
| Math/special symbols | Use entities or UTF-8 |
| Content in modern apps | UTF-8 with proper charset |
Performance Considerations
HTML parsers handle entity references efficiently, so performance impact is negligible for typical usage. However, for pages with extensive special characters, using UTF-8 encoding reduces file size compared to verbose entity references, as noted by DhiWise. The performance difference is minimal for most websites, but can matter for high-traffic pages with significant content. Following these best practices is part of building websites that load fast and rank well in search engines.
Accessibility and Entities
Proper entity usage ensures that special characters are correctly interpreted and spoken by screen readers, as highlighted by DhiWise's accessibility discussion. When characters display as gibberish due to encoding issues, users with disabilities receive incorrect information, potentially impacting their understanding of your content.
<!-- Screen reader will correctly say "copyright" -->
<p>© 2026 Company</p>
<!-- May be misread without proper encoding -->
<p>© 2026 Company</p> <!-- depends on page encoding -->
Semantic Correctness
Some symbols look similar but have different meanings. Use the correct entity rather than visual approximations for proper screen reader interpretation:
<!-- CORRECT - proper minus sign -->
<p>5 − 3 = 2</p>
<!-- WRONG - hyphen is not a minus sign -->
<p>5 - 3 = 2</p>
<!-- CORRECT - proper multiplication -->
<p>5 × 3 = 15</p>
<!-- WRONG - letter x is not multiplication -->
<p>5 x 3 = 15</p>
Using semantically correct entities ensures assistive technologies convey the intended meaning, improving accessibility for all users regardless of how they access your content. This attention to accessibility is a hallmark of professional web development services that prioritize inclusive design.
Common Mistakes and How to Avoid Them
Double Encoding
Double encoding happens when entities are encoded multiple times, often through automated processing or copy-paste from sources that already escaped characters:
<!-- WRONG - double-encoded -->
<p>AT&amp;T</p>
<!-- Displays as "AT&T" -->
<!-- CORRECT -->
<p>AT&T</p>
<!-- Displays as "AT&T" -->
Unclosed Entities
Forgetting the semicolon is a common mistake that can break rendering. Browsers try to recover by finding the next semicolon, but results are unpredictable:
<!-- WRONG - missing semicolon -->
<p>Price: &euro 99</p>
<!-- CORRECT -->
<p>Price: €99</p>
Using HTML Entities in Wrong Contexts
Entities are for HTML content only. Other contexts require different escaping approaches:
<!-- In HTML content - use entities -->
<p>Use <code> tags</p>
<!-- In JavaScript - no entities needed -->
<script>
let text = "<p>Hello</p>";
</script>
<!-- In CSS content - use CSS escape -->
<style>
.warning::after {
content: "\26A0"; /* Unicode hex for warning symbol */
}
</style>
Understanding these context differences prevents common bugs and ensures your special characters display correctly everywhere. Building a strong foundation in these fundamentals through comprehensive web development learning resources sets you up for long-term success.
The most common entities developers need daily
Essential Escaping
< = < | > = > | & = &
Common Symbols
© = © | ® = ® | ™ = ™
Currency
€ = € | GBP = £ | ¥ = ¥
Math Operators
× = × | ÷ = ÷ | ± = ±
Math Relations
≤ = ≤ | ≥ = ≥ | ≈ = ≈
Greek Letters
π = π | α = α | Ω = ω
Typography
- = – | -- = — | ... = …
Arrows
← = ← | → = → | ↑ = ↑
Quotes
" = “/” | ' = ‘/’