HTML entities replace characters that would break markup or that you cannot type easily. In a UTF-8 document you can type © and — directly, but &, <, and > inside text still need encoding. Named entities like and & remain everyday tools.
This HTML cheat sheet is written for people searching for a fast, accurate reference: students, junior developers, and teams shipping production software. Pin it, copy the snippets, and come back when syntax slips.
Quick reference
- Ampersand:
&— always encode&in text and in attribute values. - Less / greater:
<and>when showing tags as text. - Quotes:
"in double-quoted attributes;'is available but'is widely used. - nbsp:
is a non-breaking space. Do not use it to indent layouts. - Copyright:
©or the UTF-8 character ©. - Dashes:
–(–) and—(—). Hyphen-minus-is still the ASCII hyphen. - Numeric:
©decimal,©hex. Prefer named entities when they exist. - Charset: Entities are not a substitute for
<meta charset="UTF-8">.
Copy-paste examples
Safe text and a price line
Encode & in copy. Use UTF-8 for currency symbols if the file is saved as UTF-8.
<p>HTML compares tags with <div> and & attributes.</p>
<p>Price: $19 99 © 2026 Acme</p>
<p>Quote: “Ship it.”</p>Common mistakes
- Leaving raw
&in copy (Tom & Jerry) so the parser treats it as an entity start. - Indenting with chains of
instead of CSS margin or gap. - Double-encoding (
&amp;) after running text through htmlspecialchars twice. - Assuming Latin-1 numeric codes without a UTF-8 charset declaration.
FAQ
- Do I need entities for emoji? No, if the document is UTF-8. Emoji are characters. Entities are for reserved markup chars and a few stubborn symbols.