Trusted answers to developer questions

What are HTML entities?

Get Started With Machine Learning

Learn the fundamentals of Machine Learning with this free course. Future-proof your career by adding ML skills to your toolkit — or prepare to land a job in AI or Data Science.

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

RELATED TAGS

html
entities
unicode

CONTRIBUTOR

Aaron Xie
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?