Part 15: Understanding HTML Entities & Special Characters
Senior Full-Stack Developer
HTML entities are special codes used to represent characters that have special meaning in HTML or characters that are difficult to type directly.
&) and end with semicolon (;)<, >, &Entities prevent browsers from interpreting special characters as HTML code.
HTML entities follow a specific syntax pattern:
&entity_name; or &#entity_number;
< for less than symbol< for less than symbol< for less than symbolUsed to display the less than symbol without it being interpreted as the start of an HTML tag.
Used to display the greater than symbol without it being interpreted as the end of an HTML tag.
Used to display the ampersand symbol itself, since it's used to start entities.
Used to display double quotes within HTML attributes or text.
Creates a space that prevents line breaks at its position.
Displays the copyright symbol, commonly used in footers.
<p>
The formula is: x < y & y > z
</p>
<p>
He said: "Hello & welcome!"
</p>
<p>
Price: $5 & €4
</p>
<div>
Multiple spaces
</div>
The formula is: x
He said:
Price: $5
Issues: Broken rendering, missing content, HTML parsing errors
<p>
The formula is: x < y & y > z
</p>
<p>
He said: "Hello & welcome!"
</p>
<p>
Price: $5 & €4
</p>
<div>
Multiple spaces
</div>
The formula is: x < y & y > z
He said: "Hello & welcome!"
Price: $5 & €4
Perfect: All characters display correctly
Without entities, browsers interpret < and > as HTML tags, breaking the content.
Quotes inside attributes need entities to avoid closing the attribute prematurely.
Regular spaces collapse, while preserves exact spacing.
Less Than
Starts HTML tags
<
Greater Than
Ends HTML tags
>
Ampersand
Starts entities
&
Double Quote
Attribute values
"
Copyright
Copyright symbol
©
Registered
Registered trademark
®
Trademark
Trademark symbol
™
Euro
Euro currency
€
Non-breaking Space
Prevents line breaks
Section
Section symbol
§
Paragraph
Pilcrow symbol
¶
Bullet
Bullet point
•
Plus-Minus
Plus or minus
±
Multiplication
Multiply sign
×
Division
Divide sign
÷
Infinity
Infinity symbol
∞
Always use entities for <, >, &, and " when displaying them as content.
Use entities for mathematical symbols, currency signs, and legal symbols that aren't on standard keyboards.
Use when you need to prevent line breaks between words or maintain specific spacing.
Use proper entities for symbols to ensure screen readers interpret them correctly.
Use entities for accented characters and special letters in different languages.
Consider using UTF-8 characters directly when possible, as they render faster than entities.
5 < 10 & 10 > 3
Area = πr²
Temperature: 25±2°C
Company Name®
Copyright © 2024
Product Name™
He said, "Hello & welcome!"
She asked, "Ready > now?"
Comprehensive entity reference with examples and browser compatibility
Easy-to-search entity database with live examples
Online tools to convert text to entities and vice versa
Printable references for common entities
| Character | Entity Name | Entity Number | Description |
|---|---|---|---|
| < | < |
< |
Less than |
| > | > |
> |
Greater than |
| & | & |
& |
Ampersand |
| " | " |
" |
Double quote |
|
  |
Non-breaking space | |
| © | © |
© |
Copyright |
Wrong: < (missing semicolon)
Right: < (with semicolon)
Without semicolon, browsers may not recognize the entity.
Wrong: < (uppercase)
Right: < (lowercase)
Entity names are case-sensitive and should be lowercase.
Wrong: Multiple for layout
Right: Use CSS for spacing and layout
Non-breaking spaces are for content, not layout control.
Unnecessary: , for regular commas
Better: Use the character directly: ,
Only use entities when necessary for special characters.
Look for HTML parsing errors that might indicate missing entities.
Use validators to catch entity-related syntax errors.
Always preview your HTML to ensure entities display correctly.
You've mastered HTML Entities
Definition and purpose
Essential reserved characters
With vs without entities
Mathematical, legal, symbols
When and how to use entities
What to avoid
Build an HTML page that demonstrates proper use of entities:
Next: Learn about semantic HTML for better accessibility and SEO