CPCODELAB
HTML

Character Entities

5 min read

Special Characters in HTML

Some characters have special meaning in HTML (<, >, &) and cannot be typed directly as content. Others are difficult to type on a keyboard. HTML entities are escape codes that represent these characters.

html
<!-- Displaying reserved characters -->
<p>Use &lt;p&gt; for a paragraph and &lt;h1&gt; for a heading.</p>

<!-- Ampersand must be escaped -->
<p>Alice &amp; Bob</p>

<!-- Copyright and trademark -->
<p>&copy; 2026 CPCODELAB &mdash; All Rights Reserved&trade;</p>

<!-- Non-breaking space (keeps words together) -->
<p>10&nbsp;km from the city centre</p>

<!-- Quotes -->
<p>&ldquo;Hello,&rdquo; she said.</p>
  • &lt; — Less-than sign <
  • &gt; — Greater-than sign >
  • &amp; — Ampersand &
  • &quot; — Double quotation mark "
  • &apos; — Apostrophe '
  • &nbsp; — Non-breaking space
  • &copy; — Copyright symbol ©
  • &mdash; — Em dash —
Ready to test yourself?
Practice HTML— quiz & coding exercises