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 <, 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
- non-breaking space
< - less than sign
> - greater than sign
& - ampersand (&)
" - double quotation mark
' - single quotation mark
¢ - cent sign
£ - pound sign
¥ - yen sign
€ - euro sign
© - copyright
® - registered trademark
Free Resources