HTML Entities & Symbols

Show reserved characters like < and &, special symbols and emoji.

Lesson 30 of 44Beginner12 min read

Some characters have a special job in HTML. If you type <p> in your text, the browser thinks it's a tag and doesn't display it. Character entities are short codes that let you show these characters, along with many symbols that aren't on your keyboard.

You'll need entities most often when writing about code, as this site does on every page, and for a few everyday symbols such as © and the non-breaking space. Once you know the pattern, they're easy to remember.

Reserved characters you must escape

ShowWriteName
<&lt;less than
>&gt;greater than
&&amp;ampersand
"&quot;double quote (inside attributes)
'&apos;apostrophe

Every entity starts with & and ends with ;. Writing &lt;p&gt; displays <p> on the page instead of creating a paragraph.

The ampersand needs special care because it starts every entity. In text like "Fish & Chips" browsers usually cope, but writing &amp; is always correct and avoids surprises in links and attributes.

Useful symbols and their entities

SymbolEntitySymbolEntity
©&copy;€&euro;
®&reg;£&pound;
™&trade;→&rarr;
°&deg;←&larr;
×&times;♥&hearts;
·&middot;…&hellip;

You can also use numbers instead of names: &#9733; displays ★. Every character has a number, so numeric entities work even for symbols that don't have a name.

The non-breaking space

&nbsp; is a space that won't break onto a new line. Use it to keep two things together, such as 10&nbsp;km or Mr&nbsp;Smith, so a number is never left alone at the start of the next line.

Don't use lots of non-breaking spaces to push content around the page. Spacing and alignment are CSS's job, and a row of &nbsp; breaks as soon as the screen size changes.

Emoji and accented letters

With <meta charset="UTF-8"> in the head, you can type emoji and accented letters directly into your HTML: é, ñ, ü, 🍕. Entities are only required for the reserved characters. For everything else, typing the character itself keeps your code easier to read.

Named, decimal and hex references

Every character can be written three ways. The copyright sign, for example, is &copy; (named), &#169; (decimal) and &#xA9; (hexadecimal). Named entities are the easiest to read, but only some characters have names; numeric references work for every Unicode character. With UTF-8 declared, typing the character itself, ©, is usually the clearest choice, and entities remain essential only for <, >, & and quotes in attributes.

HTML Entities Syntax

Entity syntax

&name;     <!-- e.g. &copy; -->
&#number;  <!-- e.g. &#169; -->

HTML Entities Summary

  • Entities start with & and end with ;.
  • Use &lt;, &gt; and &amp; to display <, > and & as text.
  • Symbols such as © and € have named entities; any character can use a numeric one.
  • &nbsp; keeps two words on the same line but shouldn't be used for layout.
  • With UTF-8, you can type emoji and accented letters directly.

HTML Entities Examples

Each example runs in the page. Edit the code and press Run to see what changes.

Example 1

Showing code in a lesson

How do you write about HTML on a web page? With entities!

<p>To make a paragraph, write &lt;p&gt;Hello&lt;/p&gt;.</p>
<p>Fish &amp; chips costs &pound;8.50.</p>
<p>&copy; 2026 Sprout Kitchen&trade;</p>
ResultEdit the code, then press Run or Ctrl+Enter
Line-by-line explanation
  1. Line 1&lt; and &gt; show the angle brackets instead of creating a real paragraph tag.
  2. Line 2&amp; shows an ampersand; &pound; the pound sign.
  3. Line 3Copyright and trademark symbols.
Example 2

Symbols, arrows and emoji

<p>Today: 21&deg;C &middot; sunny ☀️</p>
<p>Next step &rarr; Checkout</p>
<p>Rating: &#9733;&#9733;&#9733;&#9733;&#9734;</p>
<p>Distance: 5&nbsp;km (these two never split)</p>
<p>Made with &hearts; and 🌱</p>
ResultEdit the code, then press Run or Ctrl+Enter
Line-by-line explanation
  1. Line 1&deg; for degrees, &middot; for a small dot separator, plus an emoji typed directly.
  2. Line 3Numeric entities for filled ★ and empty ☆ stars.
  3. Line 4&nbsp; glues "5" and "km" together.

Common HTML Entities Mistakes

Writing raw tags as text

Don't
<p>Use the <br> tag for line breaks.</p>
Do
<p>Use the &lt;br&gt; tag for line breaks.</p>

The first version actually inserts a line break instead of showing the text "<br>".

Forgetting the semicolon

Don't
<p>Tom &amp Jerry &copy 2026</p>
Do
<p>Tom &amp; Jerry &copy; 2026</p>

Some entities work without ; by luck, many don't. Always finish with a semicolon.

HTML Entities in Real Projects

Entities you'll actually use

Footers use &copy;. Prices use currency symbols. Tutorials (like this one!) use &lt; and &gt; constantly to show code. And when you insert user-written text into a page with JavaScript, turning < into &lt; (called escaping) is what stops people from injecting malicious HTML.

HTML Entities Exercises

Answer each one and check it instantly. If you get stuck, open the hint before the answer.

Fill in the blankseasy

Show the text <h1> on the page instead of creating a heading.

<p>The biggest heading is h1.</p>
Multiple choiceeasy

Which entity shows an ampersand (&)?

Multiple choicemedium

What does &nbsp; do?

Fix the bugeasy

The footer should show the text <footer> and a copyright symbol, but the code is wrong. Fix it.

<p>This text lives in a <footer> element.</p>
<p>(c) 2026 Bloom Studio</p>
ResultEdit the code, then press Run or Ctrl+Enter
Checks
  • The first paragraph shows "<footer>" as text
  • No real footer element was created
  • The copyright symbol is shown

HTML Entities Quiz

3 questions to check what you learned.

  1. Every named entity starts with which character?

    • #
    • &
    • <
    • $
  2. With <meta charset="UTF-8">, can you type emoji directly in HTML?

    • No, you must use entities
    • Only in headings
    • Yes
    • Only in comments
  3. What is &#169;?

    • An error
    • A colour code
    • A comment
    • A numeric entity (it's ©)

HTML Entities Challenge

Price tag

Write one paragraph that shows exactly: Burgers & fries → €12 © Diner

Use entities for &, →, € and ©.

<p></p>
ResultEdit the code, then press Run or Ctrl+Enter
Checks
  • Shows the full text correctly