Why HTML entities exist

HTML uses certain characters for syntax โ€” like angle brackets for tags. So how do you display an actual < or > character on a web page without confusing the browser?

The answer is HTML entities. An entity is a special code that represents a character. When the browser sees &lt;, it knows you want to display the less-than symbol, not start a tag.

Entities are essential for:

  • Reserved characters โ€” <, >, &, quotes โ€” that have special meaning in HTML
  • Special symbols โ€” ยฉ copyright, โ„ข trademark, โ‚ฌ euro โ€” that aren't on your keyboard
  • Non-breaking spaces โ€” spaces that won't wrap text to the next line
  • International websites โ€” currency symbols (โ‚น, ยฃ, โ‚ฌ, ยฅ, โ‚ฆ) and emojis (๐ŸŽ“, ๐Ÿ‡ฎ๐Ÿ‡ณ, ๐Ÿš€)
Key point:
Always use entities for reserved characters. Never write & directly in HTML โ€” use &amp; instead.

Reserved character entities

These four characters have special meaning in HTML and MUST be escaped if you want to display them:

reserved.html Escaping reserved characters
Character Entity Name Decimal Code Use Case
< &lt; &#60; Less than in math expressions
> &gt; &#62; Greater than in math expressions
& &amp; &#38; Ampersands in text (like in company names)
" &quot; &#34; Quotation marks in text

Common symbol entities

Beyond reserved characters, HTML provides entities for hundreds of symbols. Here are the most useful ones for web development:

symbols.html Common symbols and special characters

Numeric entities (decimal & hex)

Not every symbol has a named entity. That's where numeric entities come in. You can reference any Unicode character by its code point using decimal or hexadecimal format.

๐Ÿ”ข
Numeric Entity Format
Two ways to reference characters

Decimal: &#60; โ€” The number 60 (code for <)

Hexadecimal: &#x3C; โ€” The hex code 3C (also code for <)

numeric.html Decimal and hexadecimal entity codes
Pro tip:
International websites use numeric codes for currency symbols. The Indian Rupee (&#8377;) and Nigerian Naira (&#x20A6;) are common in e-commerce sites serving Africa and India.

Non-breaking spaces

A regular space ( ) is flexible โ€” the browser can wrap it to the next line. A non-breaking space (&nbsp;) prevents this, keeping two words together on the same line.

When to use &nbsp;:

  • Currency followed by a value: USD&nbsp;$100 โ€” keeps currency symbol and amount together
  • Product codes or serial numbers: Model&nbsp;XYZ-123
  • Dates or times: April&nbsp;18,&nbsp;2026
  • Names: John&nbsp;Doe โ€” (though rarely used in modern web design)
โœ๏ธ Try It Yourself โ€” Entity Reference Table
Preview

Emojis in HTML

Emojis are part of the Unicode standard. With proper UTF-8 encoding, you can paste emojis directly into HTML โ€” no entities needed (though you can use codes if you prefer).

Critical:
Always include <meta charset="UTF-8"> in your <head>. Without it, emojis and special characters will display as garbled text.
emojis.html Using emojis directly and via entity codes
โœ๏ธ Try It Yourself โ€” World Currencies & Flags
Preview

Arrows and more symbols

HTML includes entities for directional arrows and many other special symbols:

Symbol Entity Decimal Code Use Case
โ†’ &rarr; &#8594; Navigation, "next" links
โ† &larr; &#8592; Navigation, "back" links
โ†‘ &uarr; &#8593; Scroll to top indicators
โ†“ &darr; &#8595; Expand/dropdown indicators
โ‰ค &le; &#8804; Math, "less than or equal"
โ‰ฅ &ge; &#8805; Math, "greater than or equal"
โ€ข &bull; &#8226; Bullet points
โ€ฆ &hellip; &#8230; Ellipsis (...)
Challenge: International Price List

Task: Create an HTML page showing product prices in 5 different currencies with appropriate symbols and emojis.

Requirements:

  • Use <meta charset="UTF-8"> in the head
  • Show prices in at least 5 currencies: Rupee (โ‚น), Dollar ($), Euro (โ‚ฌ), Pound (ยฃ), and Naira (โ‚ฆ)
  • Include copyright notice using &copy;
  • Add trademark symbol using &trade;
  • Include at least 3 emojis (country flags, product icons, etc.)
  • Use non-breaking spaces where appropriate
  • Format it nicely with HTML structure (h1, h2, lists, or tables)

Use the Try It Yourself editor above as a starting point, then modify and extend it!

Hint: Start with a basic HTML skeleton. Create a product list with prices. For each product, show the price in multiple currencies using entities like &#8377; for rupee, &dollar; for dollar, &euro; for euro. Add a footer with copyright &copy; 2026 and your school name. Wrap everything in a nice layout.

Key takeaways

  • HTML entities let you display reserved characters (<, >, &) and special symbols without confusing the browser.
  • Reserved characters MUST use entities: Always use &lt;, &gt;, &amp; in HTML content.
  • Named entities are easier to read: &copy;, &euro;, &pound;, &trade;.
  • Numeric entities work for any Unicode character: &#8377; (rupee), &#x20A6; (naira).
  • Non-breaking spaces (&nbsp;) prevent text from wrapping โ€” useful for currency + amount.
  • Emojis need UTF-8: Always include <meta charset="UTF-8"> and you can paste emojis directly.
  • International websites use entities for currency symbols (โ‚น, $, โ‚ฌ, ยฃ, ยฅ, โ‚ฆ) to display correctly everywhere.

Test your knowledge

Question 1 of 5
How do you display a less-than symbol (<) in HTML?
Question 2 of 5
What does &nbsp; do?
Question 3 of 5
Which meta tag is essential for displaying emojis and special characters correctly?
Question 4 of 5
What entity displays the copyright symbol ยฉ?
Question 5 of 5
Can you use emojis directly in HTML without entity codes?
0
/5
Great work! You've mastered HTML entities.
Africa & India's Best AI Academy
๐Ÿค– AI-first ๐ŸŽ“ Placement Assistance

You've finished HTML.
Now build with CSS.

Join the Best AI Programs โ€” three 5-month courses, fully online, with placement assistance. Week 1 is free.

Explore our AI-era courses โ†’