HTML Entities & Symbols

Some characters are reserved in HTML. To display them literally, you must use an entity.

An entity looks like &name; or &#number;.

Reserved Characters

Character Entity Why
< &lt; Starts a tag
> &gt; Ends a tag
& &amp; Starts an entity
" &quot; Wraps attributes
' &apos; Wraps attributes

Example

HTML
<p>Use &lt;p&gt; to make a paragraph.</p>
<p>Ram &amp; Shyam</p>

Without entities, the browser would try to render <p> as a tag rather than show it.

Non-breaking Space

&nbsp; is a space the browser will never break a line at, and never collapses.

Example

HTML
<p>NPR&nbsp;480</p>
<p>10&nbsp;km</p>

This stops "NPR" and "480" being split across two lines.

Common Symbols

Symbol Entity
© &copy;
® &reg;
™ &trade;
€ &euro;
£ &pound;
₹ &#8377;
— &mdash;
– &ndash;
… &hellip;
→ &rarr;
★ &starf;

Example

HTML
<p>&copy; 2026 Scolar. All rights reserved.</p>
<p>Rating: &starf;&starf;&starf;&starf;&#9734;</p>

Numeric Entities

Any character can be written by its Unicode number.

Example

HTML
<p>&#2344;&#2375;&#2346;&#2366;&#2354;</p>  <!-- नेपाल -->

You Usually Do Not Need Entities

With <meta charset="UTF-8">, you can type most characters directly — including Devanagari and emoji.

Example

HTML
<meta charset="UTF-8">
...
<p>नेपाल 🇳🇵</p>

Only the five reserved characters genuinely require entities.

Escaping User Content

If your site displays text typed by visitors, you must escape <, > and & before printing it — otherwise a visitor can inject <script> into your page. This is called XSS.

See PHP Security Essentials for how to do this on the server.

Try It Yourself