HTML Entities: Writing Special Characters
You are writing a page about maths and type if a < b. The browser sees < and thinks a tag is starting. Characters that HTML uses for its own syntax need a safe way to appear as plain text, and that way is the entity.
The rule
Ampersand, name, semicolon: a character HTML cannot take literally.
An entity is a short code that the browser replaces with a single character. It always starts with & and ends with ;. The ones you will use most:
| You want | Write |
|---|---|
< |
< (less than) |
> |
> (greater than) |
& |
& (ampersand) |
" inside an attribute value |
" |
| a space that never breaks a line | |
© |
© |
<p>In HTML, a paragraph starts with <p>.</p>
<p>Fish & chips, © 2026 Harbour Cafe</p>The visitor sees "In HTML, a paragraph starts with <p>." and "Fish & chips, © 2026 Harbour Cafe".
Entities can also use numbers. © and © both mean ©, using its Unicode code point in decimal or hexadecimal.
Do you need entities for every accented letter or emoji? No. If your page declares UTF-8 encoding (you will do this with a meta tag soon), you can type é, ₹ or 🌧 directly. Entities are essential only for characters that clash with HTML syntax, mainly < and &, and handy for invisible ones like .
The shortcut
Before typing a symbol, ask: "Could the browser mistake this for markup?" If yes, use an entity.
Scan for syntax characters
The text holds
&and<, both of which HTML treats specially.
The trap is forgetting the semicolon. © without ; may work by luck in some cases, but the rule is to always close entities with a semicolon.
Drills
Answer fast — trust the rule.
Which entity shows a < character as text?
How should "R&D" be written in HTML text?
What do all entities have in common?
Your page uses UTF-8. Do you need an entity to show ₹?
Remember
- Entity =
&+ name or number +;, replaced by one character. - Shortcut: if the browser could mistake a character for markup, escape it (
<,&). - Trap: forgetting the semicolon, or escaping everything when UTF-8 already handles it.
