HTML Entities

๐Ÿ“Œ What Are HTML Entities?

HTML Entities are special codes used to display reserved characters or symbols that would otherwise be interpreted as HTML. These include characters like <, >, and &, as well as symbols like ยฉ, โ‚ฌ, โ†’, etc. ๐Ÿ’ฌ

Note

โš ๏ธ Entities are essential when you want to show characters that have specific meanings in HTML syntax!

๐Ÿ”ค Basic Syntax

An HTML entity begins with an ampersand (&) and ends with a semicolon (;). There are two main types:

  • ๐Ÿ’ก Named Entities: Use a name, like &copy;
  • ๐Ÿ’ก Numeric Entities: Use a number, like &#169;

Example: Using Entities

&lt;div&gt; &amp;copy; 2025 YourSite &lt;/div&gt;

๐Ÿ’Ž Common HTML Entities

CharacterEntity NameEntity Number
<&lt;&#60;
>&gt;&#62;
&&amp;&#38;
"&quot;&#34;
ยฉ&copy;&#169;

๐ŸŽฏ When to Use HTML Entities

  • โœ… To show special characters like <, >, & without breaking your HTML.
  • โœ… To insert symbols like ยฉ, ยฎ, ยฑ, etc. that arenโ€™t on your keyboard.
  • โœ… To ensure correct rendering across browsers and encodings.
๐Ÿ” Real-World Example

If you're displaying code in your HTML page, you'd write:

Displaying HTML Code

&lt;h1&gt;Hello World&lt;/h1&gt;

This will output exactly: <h1>Hello World</h1> instead of being interpreted as an actual heading element. ๐Ÿง 

๐Ÿงช Pro Tips

Note

๐Ÿ”ฅ You can also use tools like W3C Entity Reference to find more HTML entities!
>>โ€œDetails matter. Itโ€™s worth getting it right.โ€ โ€“ Steve Jobs ๐Ÿ’Ž