Skip to content

HTML Entities Tutorial for Beginners

HTML entities are used to display reserved characters, special symbols, and characters that are difficult to type directly in HTML. In this lesson, you will learn common HTML entities, entity syntax, examples, best practices, and mistakes beginners should avoid.

What Are HTML Entities?

HTML entities are special character codes used to display reserved characters and symbols in a web page. Some characters, such as less than < and greater than >, have special meaning in HTML, so they must be written as entities when you want to show them as text.

&lt;p&gt;This displays a paragraph tag as text.&lt;/p&gt;

HTML Entity Syntax

An HTML entity usually starts with an ampersand & and ends with a semicolon ;. You can use named entities or numeric character references.

&entityName;

&#entityNumber;

&#xhexNumber;

Named entities are easier to read, while numeric entities are useful when a named entity is not available.

Top 10 Most Used HTML Entities

The following table shows the most commonly used HTML entities beginners should know. These entities help display reserved characters, spaces, currency symbols, and common typographic symbols safely in HTML.

# Character Entity Name Entity Number Purpose
1 & &amp; &#38; Displays an ampersand symbol.
2 < &lt; &#60; Displays a less-than sign.
3 > &gt; &#62; Displays a greater-than sign.
4 " &quot; &#34; Displays a double quotation mark.
5 ' &apos; &#39; Displays a single quotation mark.
6 Non-breaking space &nbsp; &#160; Adds a space that does not break into a new line.
7 © &copy; &#169; Displays the copyright symbol.
8 ® &reg; &#174; Displays the registered trademark symbol.
9 &trade; &#8482; Displays the trademark symbol.
10 &euro; &#8364; Displays the euro currency symbol.

Reserved Characters in HTML

Some characters are reserved in HTML because browsers use them to understand tags, attributes, and markup. When you want to display these characters as text, use entities.

&lt;h1&gt;HTML Entities&lt;/h1&gt;

&amp;

&quot;HTML Tutorial&quot;

This helps prevent the browser from treating your text as actual HTML code.

Named Entities vs Numeric Entities

HTML supports both named entities and numeric entities. Named entities are easier for humans to understand, while numeric entities can represent many Unicode characters.

Type Example Result Use Case
Named Entity &copy; © Easy-to-read common symbols.
Numeric Entity &#169; © Useful when a named entity is not available.
Hexadecimal Entity &#x00A9; © Useful for Unicode-based symbols.

How to Display HTML Code as Text

If you want to show HTML tags inside a tutorial, blog post, or documentation page, you must escape the less-than and greater-than characters.

&lt;p&gt;This is a paragraph.&lt;/p&gt;

The browser displays it like this:

<p>This is a paragraph.</p>

Non-Breaking Space in HTML

The &nbsp; entity creates a space that prevents words from breaking across lines. It is useful for keeping related words or numbers together.

HTML&nbsp;Tutorial

10&nbsp;GB

Mr.&nbsp;Smith

Use &nbsp; carefully. For general spacing and layout, CSS is usually the better choice.

Currency and Symbol Entities

HTML entities are also useful for displaying currency symbols, math symbols, and typographic symbols.

&dollar;100

&euro;50

&pound;40

&yen;5000

&copy; 2026 PHPKINGDOM

HTML Entities for SEO and Accessibility

HTML entities help display characters correctly, but they should be used only when needed. Clean and readable content is better for users, search engines, and assistive technologies.

  • Use entities for reserved characters like <, >, and &.
  • Use real readable text where possible instead of unnecessary symbols.
  • Use semantic HTML tags along with entities for better structure.
  • Avoid using many &nbsp; entities for layout spacing.
  • Use CSS for visual spacing and alignment.

Common HTML Entity Mistakes

  • Forgetting the semicolon at the end of an entity.
  • Using &nbsp; repeatedly instead of CSS spacing.
  • Typing < and > directly when displaying code examples.
  • Using symbols without checking browser or encoding support.
  • Mixing too many entity styles when one consistent style is better.

Key Takeaways

  • HTML entities display reserved characters and special symbols safely.
  • Entities usually start with & and end with ;.
  • Use &lt; and &gt; to display HTML tags as text.
  • Use &nbsp; only when a non-breaking space is needed.
  • For layout spacing, use CSS instead of multiple spaces or entities.

Pro Tip

When writing HTML tutorials, always escape code examples using &lt; and &gt; so the browser displays the code instead of rendering it.