HTML Entities
HTML entities are used in HTML for displaying reserved characters that might be confused with HTML code, invisible characters and characters that are not present on a normal keyboard.
There are a lot of symbols that are not present on a standard keyboard (mathematical, technical, currency symbols, etc.). Also, there are symbols that cannot be used because they can cause confusion. For example, we cannot use > because in HTML this symbol is parsed as a tag delimiter, and the browser won’t show it as text.
In HTML, entities display reserved characters, which can be confused with HTML code or invisible characters, like non-breaking spaces. They also represent characters that are difficult or impossible to type with a keyboard.
You can use an HTML entity name to add such symbols to an HTML page. If an entity name does not exist, you can use a decimal or hexadecimal numeric reference. An entity name is easy to remember. But these names may not be supported by browsers. However, the support for numbers is good. For maximum compatibility across all browsers and legacy systems, numeric references are generally preferred over named entities.
An HTML entity begins with an ampersand (&) and ends with a semicolon. Note: Entity names are case-insensitive in HTML5, though some older browsers may handle them inconsistently.
For example:
<p>5 < 10 and 10 > 5</p>
<title>HTML entities & symbols</title>
<p>Snowman: ☃ or ☃</p>Character Entities Commonly Used in HTML
| Result | Description | Entity Name | Entity Number |
|---|---|---|---|
| non-breaking space | |   | |
| < | less than | < | < |
| > | greater than | > | > |
| & | ampersand | & | & |
| ¢ | cent | ¢ | ¢ |
| £ | pound | £ | £ |
| ¥ | yen | ¥ | ¥ |
| € | euro | € | € |
| § | section | § | § |
| © | copyright | © | © |
| ® | registered trademark | ® | ® |
| ™ | trademark | ™ | ™ |
Math Symbols Supported by HTML
| Character | Entity Number | Entity Name | Description |
|---|---|---|---|
| ∀ | ∀ | ∀ | for all |
| ∂ | ∂ | ∂ | part |
| ∃ | ∃ | ∃ | exists |
| ∅ | ∅ | ∅ | empty |
| ∇ | ∇ | ∇ | nabla |
| ∈ | ∈ | ∈ | isin |
| ∉ | ∉ | ∉ | notin |
| ∋ | ∋ | ∋ | ni |
| ∏ | ∏ | ∏ | prod |
| ∑ | ∑ | ∑ | sum |
| − | − | − | minus |
| ∗ | ∗ | ∗ | lowast |
| √ | √ | √ | square root |
| ∝ | ∝ | ∝ | proportional to |
| ∞ | ∞ | ∞ | infinity |
| ∠ | ∠ | ∠ | angle |
| ∧ | ∧ | ∧ | and |
| ∨ | ∨ | ∨ | or |
| ∩ | ∩ | ∩ | cap |
| ∪ | ∪ | ∪ | cup |
| ∫ | ∫ | ∫ | integral |
| ∴ | ∴ | ∴ | therefore |
| ∼ | ∼ | ∼ | similar to |
| ≅ | ≅ | ≅ | congruent to |
| ≈ | ≈ | ≈ | almost equal |
| ≠ | ≠ | ≠ | not equal |
| ≡ | ≡ | ≡ | equivalent |
| ≤ | ≤ | ≤ | less or equal |
| ≥ | ≥ | ≥ | greater or equal |
| ⊂ | ⊂ | ⊂ | subset of |
| ⊃ | ⊃ | ⊃ | superset of |
| ⊄ | ⊄ | ⊄ | not subset of |
| ⊆ | ⊆ | ⊆ | subset or equal |
| ⊇ | ⊇ | ⊇ | superset or equal |
| ⊕ | ⊕ | ⊕ | circled plus |
| ⊗ | ⊗ | ⊗ | circled times |
| ⊥ | ⊥ | ⊥ | perpendicular |
| ⋅ | ⋅ | ⋅ | dot operator |
Greek Letters Supported by HTML
| Character | Entity Number | Entity Name | Description |
|---|---|---|---|
| Α | Α | Α | Alpha |
| Β | Β | Β | Beta |
| Γ | Γ | Γ | Gamma |
| Δ | Δ | Δ | Delta |
| Ε | Ε | Ε | Epsilon |
| Ζ | Ζ | Ζ | Zeta |
| Η | Η | Η | Eta |
| Θ | Θ | Θ | Theta |
| Ι | Ι | Ι | Iota |
| Κ | Κ | Κ | Kappa |
| Λ | Λ | Λ | Lambda |
| Μ | Μ | Μ | Mu |
| Ν | Ν | Ν | Nu |
| Ξ | Ξ | Ξ | Xi |
| Ο | Ο | Ο | Omicron |
| Π | Π | Π | Pi |
| Ρ | Ρ | Ρ | Rho |
| Σ | Σ | Σ | Sigma |
| Τ | Τ | Τ | Tau |
| Υ | Υ | Υ | Upsilon |
| Φ | Φ | Φ | Phi |
| Χ | Χ | Χ | Chi |
| Ψ | Ψ | Ψ | Psi |
| Ω | Ω | Ω | Omega |
| α | α | α | alpha |
| β | β | β | beta |
| γ | γ | γ | gamma |
| δ | δ | δ | delta |
| ε | ε | ε | epsilon |
| ζ | ζ | ζ | zeta |
| η | η | η | eta |
| θ | θ | θ | theta |
| ι | ι | ι | iota |
| κ | κ | κ | kappa |
| λ | λ | λ | lambda |
| μ | μ | μ | mu |
| ν | ν | ν | nu |
| ξ | ξ | ξ | xi |
| ο | ο | ο | omicron |
| π | π | π | pi |
| ρ | ρ | ρ | rho |
| ς | ς | ς | sigmaf |
| σ | σ | σ | sigma |
| τ | τ | τ | tau |
| υ | υ | υ | upsilon |
| φ | φ | φ | phi |
| χ | χ | χ | chi |
| ψ | ψ | ψ | psi |
| ω | ω | ω | omega |
| ϑ | ϑ | ϑ | theta symbol |
| Υ | ϒ | ϒ | upsilon symbol |
| ϖ | ϖ | ϖ | pi symbol |
Other Entities Supported by HTML
| Character | Entity Number | Entity Name | Description |
|---|---|---|---|
| Œ | Œ | Œ | capital ligature OE |
| œ | œ | œ | small ligature oe |
| Š | Š | Š | capital S with caron |
| š | š | š | small S with caron |
| Ÿ | Ÿ | Ÿ | capital Y with diaeres |
| ƒ | ƒ | ƒ | f with hook |
| ˆ | ˆ | ˆ | modifier letter circumflex accent |
| ˜ | ˜ | ˜ | small tilde |
  |   | en space | |
  |   | em space | |
  |   | thin space | |
| | ‌ | ‌ | zero width non-joiner |
| | ‍ | ‍ | zero width joiner |
| | ‎ | ‎ | left-to-right mark |
| | ‏ | ‏ | right-to-left mark |
| – | – | – | en dash |
| — | — | — | em dash |
| ‘ | ‘ | ‘ | left single quotation mark |
| ’ | ’ | ’ | right single quotation mark |
| ‚ | ‚ | ‚ | single low-9 quotation mark |
| “ | “ | “ | left double quotation mark |
| ” | ” | ” | right double quotation mark |
| „ | „ | „ | double low-9 quotation mark |
| † | † | † | dagger |
| ‡ | ‡ | ‡ | double dagger |
| • | • | • | bullet |
| … | … | … | horizontal ellipsis |
| ‰ | ‰ | ‰ | per mille |
| ′ | ′ | ′ | minutes |
| ″ | ″ | ″ | seconds |
| ‹ | ‹ | ‹ | single left angle quotation |
| › | › | › | single right angle quotation |
| ‾ | ‾ | ‾ | overline |
| € | € | € | euro |
| ™ | ™ | ™ | trademark |
| ← | ← | ← | left arrow |
| ↑ | ↑ | ↑ | up arrow |
| → | → | → | right arrow |
| ↓ | ↓ | ↓ | down arrow |
| ↔ | ↔ | ↔ | left right arrow |
| ↵ | ↵ | ↵ | carriage return arrow |
| ⌈ | ⌈ | ⌈ | left ceiling |
| ⌉ | ⌉ | ⌉ | right ceiling |
| ⌊ | ⌊ | ⌊ | left floor |
| ⌋ | ⌋ | ⌋ | right floor |
| ◊ | ◊ | ◊ | lozenge |
| ♠ | ♠ | ♠ | spade |
| ♣ | ♣ | ♣ | club |
| ♥ | ♥ | ♥ | heart |
| ♦ | ♦ | ♦ | diamond |
Non-breaking Space
The non-breaking space ( ) is one of the most common character entities used in HTML. It is a space that doesn’t break into a new line. This means that two words that are divided by a non-breaking space will stay together. Besides, the non-breaking space stops browsers from truncating spaces in HTML pages.
Diacritical Marks
When we say a diacritical mark, we mean a “glyph” that is added to a letter. Some of these marks, like grave (̀) and acute (́) are called accents. Diacritical marks may occur above and below a letter, between two letters or inside a letter.
Here is a list containing some diacritical marks:
| Mark | Character | Construct | Result |
|---|---|---|---|
| ̀ | a | à | à |
| ́ | a | á | á |
| ̂ | a | â | â |
| ̃ | a | ã | ã |
| ̀ | O | Ò | Ò |
| ́ | O | Ó | Ó |
| ̂ | O | Ô | Ô |
| ̃ | O | Õ | Õ |
Practice
Which of the following HTML entities can be used to define special characters that are reserved in HTML?