HTML Entities

HTML Tutorial: HTML Entities

Learn how to use HTML entities to display special characters, symbols, and reserved characters with colorful examples and results


HTML entities are used to display special characters that would otherwise be interpreted as HTML code. Commonly used for symbols, reserved characters, and emojis.


1️⃣ Reserved Characters

INPUT:


<p>5 < 10 and 10 > 5</p>
<p>Use & for & symbol</p>

OUTPUT:

5 < 10 and 10 > 5

Use & for & symbol

✔️ < is displayed using &lt; ✔️ > is displayed using &gt; ✔️ & is displayed using &amp;


2️⃣ Common Symbols

INPUT:


<p>Copyright © 2026</p>
<p>Registered Trademark ®</p>
<p>Non-breaking space here</p>

OUTPUT:

Copyright © 2026

Registered Trademark ®

Non-breaking space here

✔️ © → © (copyright) ✔️ ® → ® (registered trademark) ✔️   → non-breaking space


3️⃣ Mathematical Symbols

INPUT:


<p>Pi π is approximately 3.14159</p>
<p>Less than or equal ≤ 10</p>
<p>Greater than or equal ≥ 5</p>

OUTPUT:

Pi π is approximately 3.14159

Less than or equal ≤ 10

Greater than or equal ≥ 5

✔️ Ï€ → Ï€ ✔️ ≤ → ≤ ✔️ ≥ → ≥ ✔️ Useful for math formulas in HTML


4️⃣ Emojis and Special Characters

INPUT:


<p>Smiley Face </p>
<p>Check mark ✓</p>
<p>Star ★</p>

OUTPUT:

Smiley Face 😀

Check mark ✓

Star ★

✔️ Use decimal or hexadecimal codes for emojis and symbols ✔️  → 😀, ✓ → ✓, ★ → ★


5️⃣ Best Practices for HTML Entities

  • Use entities for reserved HTML characters (<, >, &)
  • Use entities for symbols like ©, ®, ±, etc.
  • Use entities to insert non-breaking spaces or special formatting
  • Use numeric codes for emojis and uncommon symbols
  • Keep entity usage consistent for readability

🚀 What’s Next?

👉 HTML Symbols

Next lesson will cover:

  • HTML symbols for arrows, currency, math, and other types
  • How to insert them using named and numeric entities
  • Colorful examples with inputs and outputs for clarity

Using HTML entities ensures special characters and symbols are displayed correctly, preventing conflicts with HTML code and improving readability.

Post a Comment

Share your thoughts! Please be respectful and avoid spam

Previous Post Next Post