Skip to main content

Advanced HTML

HTML Entities & Symbols

Written by Updated HTML Entities & Symbols exercises

Some characters have a special job in HTML. A < starts a tag, and an & starts an entity. To show them as plain text, you write them as entities: &lt; for <, &amp; for &. Entities also let you type symbols that are not on your keyboard, like © or ₹.

An entity starts with & and ends with ;. In between is either a name, like copy, or a number, like #169. Both give the same character.

Syntax

html

&entity_name;
OR
&#entity_number;

When you must use an entity

Only two characters really need it in normal text:

  • < must be written &lt; whenever it could look like the start of a tag. x<y may survive, but x<b turns into a broken bold tag.
  • & should be written &amp; when it is followed by letters, like "Tom & Jerry" or a URL with ?a=1&b=2, so the browser does not read it as the start of an entity.

Inside attribute values, write &quot; for a " if the value is wrapped in double quotes. And > is safe in text, but writing &gt; keeps code samples easy to read.

Showing reserved characters as text

html

<p>10 &lt; 20 &amp;&amp; 20 &gt; 10</p>

That shows 10 < 20 && 20 > 10 on the page, exactly as written for a JavaScript lesson.

Commonly used entities

CharacterEntity nameEntity numberMeaning
<&lt;&#60;Less than
>&gt;&#62;Greater than
&&amp;&#38;Ampersand
"&quot;&#34;Double quote
'&apos;&#39;Apostrophe
©&copy;&#169;Copyright
®&reg;&#174;Registered trademark
™&trade;&#8482;Trademark
₹none&#8377;Indian rupee
€&euro;&#8364;Euro
£&pound;&#163;Pound
→&rarr;&#8594;Right arrow

Entities in a page

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>HTML Entities Example</title>
</head>
<body>
  <h2>HTML Entities Demo</h2>
  <p>5 &lt; 10 and 10 &gt; 5</p>
  <p>Copyright &copy; 2025 HTML5 &amp; CSS3</p>
  <p>Price: &#8377;500</p>
  <p>Symbols: &hearts; &star; &check; &trade;</p>
</body>
</html>

Math and other symbols

SymbolEntityMeaning
×&times;Multiplication
÷&divide;Division
±&plusmn;Plus or minus
≠&ne;Not equal
∞&infin;Infinity
∑&sum;Sum
♥&hearts;Heart
✓&check;Check mark

Do you still need entities for symbols?

Not really. If your page has <meta charset="UTF-8">, and it should, you can type or paste ©, ₹ or ✓ directly into the HTML and they will display correctly. Entities for symbols are now mostly a convenience when a character is hard to type. The reserved characters < and & are the ones you must still escape.

One entity people misuse is &nbsp;, the non-breaking space. Use it to keep two words together on one line, like "10 kg". Do not use rows of them to create spacing; that is what CSS margin and padding are for.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

HTML Entities & Symbols exercises

Show a less-than sign

Write the paragraph 5 < 9 and use the entity for the sign.

Result

Check your answer to see it here.