ENTITIES7 min20 XP

HTML Entities

Learn HTML Entities with syntax-highlighted examples, live output, and Shiv AI.

HTML Entities and Special Characters

Some characters have special meaning in HTML — like < and > which mark tags. To display them as visible text you use HTML entities. They start with & and end with ;.

The Problem — Reserved Characters

Example — Why Entities Are Needed
<!-- WRONG: browser thinks <b> is a new tag -->
<p>The tag for bold is <b> in HTML</p>

<!-- CORRECT: use &lt; and &gt; -->
<p>The tag for bold is &lt;b&gt; in HTML</p>

The tag for bold is <b> in HTML

Using &lt; and &gt; displays the angle brackets as visible text without confusing the HTML parser.

Common Entities

Example — Essential Entities in Use
<p>Copyright: &copy; 2025 CIWeb</p>
<p>Trademark: CIWeb&trade;</p>
<p>Price: &#8377;11</p>
<p>Arrow: Home &rarr; Courses</p>
<p>Dash: HTML &mdash; the skeleton</p>
<p>Non-breaking: Rs.&nbsp;11</p>

Copyright: © 2025 CIWeb

Trademark: CIWeb™

Price: ₹11

Arrow: Home → Courses

Dash: HTML — the skeleton

Non-breaking: Rs. 11

Essential EntitiesMust Know
&amp;Displays & — ampersand. Required in URLs and text
&lt;Displays < — less than. Required to show HTML tags as text
&gt;Displays > — greater than
&nbsp;Non-breaking space. Prevents line break between words
&copy;Displays © copyright symbol
&trade;Displays ™ trademark
&reg;Displays ® registered trademark
&#8377;Displays ₹ Indian Rupee (numeric code)
&euro;Displays € Euro currency
&rarr;Displays → right arrow. Used in breadcrumbs
&mdash;Displays — em dash. Longer than hyphen
Always Escape These

Always use &amp; &lt; &gt; when displaying them as visible text. Leaving them unescaped can break your HTML or introduce XSS security vulnerabilities.

Named vs Numeric

Entities have named forms like &copy; and numeric forms like &#169;. Named are more readable. Numeric work for any Unicode character even without a name — like the Indian Rupee sign.

Why Entities Exist

HTML uses < and > for tags so you cannot type them directly as visible text — the browser would think a new tag is starting. Entities are the escape system that separates HTML syntax from displayed content.

CIWeb HTML Course • 22 Lessons • Free

Explain with Analogies

Shiv AI explains this lesson using only real-life analogies. No code at all.

Click the Explain tab to generate analogies automatically.
index.html
Live Preview
Start coding - Shiv AI monitors automatically

How do you display the < character as visible text?

Explanation&lt; is the HTML entity for the less-than sign. Typing < directly makes the browser think a new tag is starting which breaks your HTML.
Build Challenge
Entities Page
Build a page showing reserved characters, symbols, currency, and arrows using HTML entities.
Requirements (5 to pass)
amp entity
lt entity
gt entity
copyright
nbsp
solution.html
Preview
Community Wall
Lesson 14
0/500
0/20 lines
as
Recent Posts
Lesson 14 only

Support CIWeb + Get +50 AI Messages

Just Rs.11 gives you 50 extra Shiv AI messages and keeps CIWeb free for everyone.

AI
Shiv AI
Online