Skip to the workspace
Pebellslearn by building
HTML Syntax  ›  Lesson

HTML Entities: Writing Special Characters

HTML Entities 12 minAn HTML entity is a code starting with an ampersand and ending with a semicolon that stands for a character which would otherwise be read as markup or is hard to type.

html / HTML Entities: Writing Special Characters

Explore each scene at your own pace.

01 · The rule

The rule

HTML Entities: Writing Special Characters

An HTML entity is a code starting with an ampersand and ending with a semicolon that stands for a character which would otherwise be read as markup or is hard to type.

Represent reserved characters as text without accidentally introducing markup.

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
< &lt; (less than)
> &gt; (greater than)
& &amp; (ampersand)
" inside an attribute value &quot;
a space that never breaks a line &nbsp;
© &copy;
<p>In HTML, a paragraph starts with &lt;p&gt;.</p>
<p>Fish &amp; chips, &copy; 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. &#169; and &#xA9; 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 &nbsp;.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.