HTML Entities


HTML entities are special codes used to display reserved characters or symbols in HTML that would otherwise be interpreted as HTML code. They help show characters like <, >, &, or special symbols such as ©, ®, £, etc.


🔹 Why Use HTML Entities?

  • To display characters reserved by HTML (like < and >)

  • To show special symbols not available on keyboard

  • To avoid conflicts with HTML parsing


🔹 Syntax of HTML Entities

  • Named Entity: &entity_name;
    Example: &lt; for <

  • Numeric Entity: &#number; (decimal)
    Example: &#60; for <

  • Hexadecimal Entity: &#xhex_number;
    Example: &#x3C; for <


💻 Common HTML Entities Table

Symbol Named Entity Decimal Hexadecimal Description
< &lt; &#60; &#x3C; Less than
> &gt; &#62; &#x3E; Greater than
& &amp; &#38; &#x26; Ampersand
" &quot; &#34; &#x22; Double quote
' &apos;* &#39; &#x27; Single quote (apostrophe)
© &copy; &#169; &#xA9; Copyright symbol
® &reg; &#174; &#xAE; Registered trademark
&euro; &#8364; &#x20AC; Euro sign

*Note: &apos; is not supported in older versions of HTML but works in XHTML and HTML5.


💻 Example: Using HTML Entities

<p>Use &lt;strong&gt; to make text bold.</p>
<p>Price: &euro;100</p>
<p>Copyright &copy; 2025 My Website</p>
<p>Use &amp; to display an ampersand.</p>

Practice Questions

Q1. Write HTML to display <html> tags on a page using entities.

Q2. Show the text: Tom & Jerry correctly with the ampersand.

Q3. Display the copyright symbol © using entities.

Q4. Write a paragraph that includes quotes "Hello" using entities.

Q5. Show the registered trademark symbol ® in HTML.

Q6. Use numeric entity to display less than < symbol.

Q7. Display an email address with @ sign properly escaped.

Q8. Show the Euro sign € using a named entity.

Q9. Encode a sentence with multiple special characters: <, >, &.

Q10. Create a list showing different quotation marks using HTML entities.


Go Back Top