Advanced10 min read

HTML Entities & Special Characters

Learn how to display reserved characters, typographic symbols, and emoji in HTML using named entities, numeric references, and Unicode code points.

Why HTML Entities Exist

Some characters have special meaning in HTML. The angle brackets < and > define tags, and the ampersand & starts an entity reference. If you type these characters directly into your content, the browser will try to interpret them as code rather than display them.

HTML entities let you represent these reserved characters — and many other symbols — safely inside your markup. Every entity starts with & and ends with ;.

Named Entities

Named entities use a human-readable keyword between & and ;. Here are the most common ones:

EntityCharacterDescription
&lt;<Less-than sign
&gt;>Greater-than sign
&amp;&Ampersand
&nbsp;(non-breaking space)Prevents line break between words
&copy;©Copyright symbol
&reg;®Registered trademark
&trade;Trademark
&mdash;Em dash
&ndash;En dash
&laquo;«Left double angle quote
&raquo;»Right double angle quote
&euro;Euro sign
&pound;£Pound sign

You must use entities for <, >, and & when you want to display them as text. For other symbols, entities are one option among several.

Numeric and Unicode Entities

When no named entity exists, you can use numeric references:

  • Decimal: &#169; renders as © (the number is the Unicode code point in decimal).
  • Hexadecimal: &#x00A9; also renders as © (prefix the hex value with x).

This lets you display any Unicode character, including emoji:

  • &#x2764; → ❤ (heavy black heart)
  • &#x1F680; → 🚀 (rocket)
  • &#x2603; → ☃ (snowman)

With modern UTF-8 encoding, you can also type Unicode characters directly in your source code. Entities are still preferred when the character might be confused with markup or when the source file encoding is uncertain.

Entities in Practice

html
<!-- Reserved characters — must use entities -->
<p>In HTML, tags are written with &lt;angle brackets&gt;.</p>
<p>Use &amp;amp; to display an ampersand.</p>

<!-- Typographic symbols -->
<p>&copy; 2025 Kodojo &mdash; All rights reserved.</p>
<p>Price: &euro;29.99</p>

<!-- Non-breaking space to prevent awkward line breaks -->
<p>100&nbsp;km</p>

<!-- Unicode / numeric entities -->
<p>I &#x2764; HTML!</p>

Which characters MUST be represented as HTML entities when used as visible text content?

Ready to practice?

Create your free account to access the interactive code editor, run challenges, and track your progress.