What are HTML entities?

An HTML entity is used to display invisible characters and reserved characters that would otherwise be interpreted as HTML code. It is a piece of text, or string, that begins with an ampersand (&) and ends with a semicolon (;).

Typically, HTML will interpret the less-than sign (<) as a tag. If you would like to have the less-than sign as text, HTML allows you to write &lt;, as seen from the example above.

When to use HTML entities?

Generally, you don’t need to use HTML entities if your editor supports Unicode. For some instances, entities can be useful:

  • Your editor does not support Unicode.

  • Your keyboard does not support the character you would like to type, such as em-dash or the copyright symbol.

  • You want specific HTML-specific characters like <, &, or ".

Useful HTML entities

&nbsp; - non-breaking space

&lt; - less than sign

&gt; - greater than sign

&amp; - ampersand (&)

&quot; - double quotation mark

&apos; - single quotation mark

&cent; - cent sign

&pound; - pound sign

&yen; - yen sign

&euro; - euro sign

&copy; - copyright

&reg; - registered trademark

Copyright ©2024 Educative, Inc. All rights reserved