Why Entities Exist
The browser uses < and > to identify HTML tags, and & to start an entity. If you type these directly as content the browser gets confused:
HTML
<!-- Problem: browser thinks <script> is a real tag -->
<p>Use the <script> tag for JavaScript.</p>
<!-- Solution: escape the angle brackets -->
<p>Use the <script> tag for JavaScript.</p>
<!-- Renders as: Use the <script> tag for JavaScript. -->
Most Common HTML Entities
| Entity | Character | Description |
|---|---|---|
< | < | Less-than sign (tag open) |
> | > | Greater-than sign (tag close) |
& | & | Ampersand |
" | " | Double quote |
' | ' | Apostrophe / single quote |
| (space) | Non-breaking space โ prevents line break between words |
© | ยฉ | Copyright symbol |
® | ยฎ | Registered trademark |
™ | โข | Trademark symbol |
— | โ | Em dash |
– | โ | En dash |
… | โฆ | Ellipsis |
€ | โฌ | Euro sign |
£ | ยฃ | Pound sign |
→ | โ | Right arrow |
← | โ | Left arrow |
Ad โ 336ร280
Practical Examples
HTML
<!-- Copyright footer -->
<p>© 2026 ylearner. All rights reserved.</p>
<!-- Non-breaking space: prevents "10" and "km" splitting onto separate lines -->
<p>Distance: 10 km</p>
<!-- Displaying code in text -->
<p>The <div> tag is a block container.</p>
<!-- Price range with en dash -->
<p>Price: £10–£50</p>
<!-- Trademark -->
<p>ylearner™ โ Learn to code for free.</p>
<!-- Numeric entity (decimal) -->
<p>© 2026</p> <!-- Same as © -->
<!-- Numeric entity (hex) -->
<p>♥</p> <!-- โฅ -->
Entities vs Unicode in HTML5
With <meta charset="UTF-8"> (which every modern HTML5 page should have), you can type most special characters directly into your HTML file โ your code editor saves them as UTF-8 characters the browser reads correctly. Entities are still useful for <, >, and & which are structurally significant, and for non-breaking spaces.
HTML
<!-- In HTML5 with UTF-8, these are equivalent: -->
<p>© 2026</p>
<p>ยฉ 2026</p> <!-- Direct Unicode character -->
<!-- But these MUST use entities: -->
<p><tag></p> <!-- Displaying < and > as text -->
<p>5 & 10</p> <!-- Displaying & as text -->
๐ Summary
- HTML entities start with
&and end with;โ e.g.&,<,©. - Must-escape:
<(<),>(>),&(&) โ these are structurally reserved in HTML. โ non-breaking space, prevents unwanted line breaks.- In HTML5 with UTF-8, you can type most symbols directly. Entities are mainly needed for the reserved characters.