HTML Entities
29 March 2025 | Category: HTML
HTML entities are special codes used to display reserved characters, symbols, or invisible characters in a web browser. They are particularly useful when you want to display characters that have special meanings in HTML or are not available on a standard keyboard.
1. What Are HTML Entities?
- HTML entities begin with an ampersand (&) and end with a semicolon (;).
- For example:
- <represents- <
- >represents- >
 
Why Use HTML Entities?
- To display reserved characters (like <or>).
- To include non-keyboard characters (like ©or€).
- To ensure proper rendering across different browsers.
2. Common HTML Entities
Reserved Characters
These characters have special meanings in HTML and need to be represented as entities:
| Character | Entity Name | Entity Number | Description | 
|---|---|---|---|
| < | < | < | Less than | 
| > | > | > | Greater than | 
| & | & | & | Ampersand | 
| " | " | " | Double quote | 
| ' | ' | ' | Single quote | 
Symbols
| Character | Entity Name | Entity Number | Description | 
|---|---|---|---|
| © | © | © | Copyright symbol | 
| ® | ® | ® | Registered trademark | 
| € | € | € | Euro sign | 
| £ | £ | £ | British pound sign | 
| ¥ | ¥ | ¥ | Japanese yen sign | 
| ¢ | ¢ | ¢ | Cent sign | 
| ÷ | ÷ | ÷ | Division sign | 
| × | × | × | Multiplication sign | 
Mathematical Entities
| Character | Entity Name | Entity Number | Description | 
|---|---|---|---|
| ≤ | ≤ | ≤ | Less than or equal | 
| ≥ | ≥ | ≥ | Greater than or equal | 
| ± | ± | ± | Plus-minus | 
| √ | √ | √ | Square root | 
| ∞ | ∞ | ∞ | Infinity | 
| ≈ | ≈ | ≈ | Approximately equal | 
Arrow Entities
| Character | Entity Name | Entity Number | Description | 
|---|---|---|---|
| ← | ← | ← | Left arrow | 
| → | → | → | Right arrow | 
| ↑ | ↑ | ↑ | Up arrow | 
| ↓ | ↓ | ↓ | Down arrow | 
3. How to Use HTML Entities
HTML entities can be used anywhere in HTML content, such as inside text, attributes, or titles.
Example 1: Display Reserved Characters
<p>Use <h1> for main headings.</p>
Output:
Use <h1> for main headings.
Example 2: Display Symbols
<p>© 2025 My Company. All rights reserved.</p>
Output:
© 2025 My Company. All rights reserved.
Example 3: Mathematical Symbols
<p>The result of 5 × 4 is 20.</p>
Output:
The result of 5 × 4 is 20.
4. Invisible Characters
HTML entities can also represent invisible characters like spaces or non-breaking spaces.
Non-breaking Space ( )
- Prevents text from breaking into a new line.
<p>Hello, world!</p>
Output:
Hello, world!
(No line break allowed between “Hello,” and “world!”)
En Space and Em Space
| Character | Entity Name | Description | 
|---|---|---|
|   |   | En space (half space) | 
|   |   | Em space (full space) | 
5. Combining Entities
You can mix multiple HTML entities to display complex content.
<p><div> represents a block-level element. © 2025</p>
Output:<div> represents a block-level element. © 2025
6. Unicode Characters
HTML entities also support Unicode for a vast range of characters and symbols. Use &#x followed by the hexadecimal Unicode value.
Example:
<p>😀 represents a smiley face.</p>
Output:
😀 represents a smiley face.
7. Browser Support
HTML entities are supported in all major browsers. However, always test special characters to ensure proper rendering.
8. Tips for Using HTML Entities
- Use when necessary: Most browsers handle special characters well, so only use entities for reserved or uncommon symbols.
- Check compatibility: Test complex entities across devices and browsers.
- Readable code: Replace entities with symbols when they don’t conflict with HTML syntax to keep code clean.
9. Summary Table
Here’s a quick summary of commonly used HTML entities:
| Symbol | Entity Name | Entity Number | 
|---|---|---|
| & | & | & | 
| < | < | < | 
| > | > | > | 
| © | © | © | 
| ® | ® | ® | 
| £ | £ | £ | 
| € | € | € | 
| ± | ± | ± | 
Using HTML entities effectively ensures that your content is displayed as intended and remains accessible across various platforms. Whether you’re creating a simple webpage or a complex web application, understanding HTML entities is a fundamental skill for every web developer.
