HTML entities are strings that display special characters on a web page.
Special characters include reserved chararacters, like euro € and delta Δ.
Also included are non-keyboard characters such as, copyright © and section §
An HTML entity begins with an ampersand (&
) and ends with a semicolon (;
)
This example displays a british pound sign (£), angled brackets (< and >), and a copyright symbol (©).
They are created with the £
, <
, >
, and ©
entities.
£ < > ©
<p style='font-size:50px;'>£ < > ©</p>
Web pages use HTML markup which makes extensive use of < and > characters.
This means < and > cannot be used in content because it would confuse the browser.
HTML Entities solve this by using <
and >
which display as < and >.
In addition, many characters are not available on keyboards, such as the greek gamma character.
HTML Entities also solves this by using γ
which displays as γ.
A common HTML entity used in web pages is the non-breaking space:
A non-breaking space is a space that will not break into a new line.
Two words separated by a non-breaking space will stick together.
They will not break even when there are space constraints.
This feature is important when breaking the words might be disruptive, such as '10 mph', '20 pixels'.
The
makes these non-breaking. Here are some examples.
<div>10 km/h</div>
<div>10 PM</div>
<div>§ 10</div>
<div>845.65 USD</div>
Tip: Another common use of
is to prevent browsers from collapsing spaces in text.
Browsers collapse multiple spaces into a single space, but not the
characters.
This table lists some of the commonly used HTML character entities.
Result | Description | Entity Name | Entity Number |
---|---|---|---|
non-breaking space | |   | |
< | less than | < | < |
> | greater than | > | > |
& | ampersand | & | & |
" | double quotation mark | " | " |
' | single quotation mark (apostrophe) | ' | ' |
¢ | cent | ¢ | ¢ |
£ | pound | £ | £ |
¥ | yen | ¥ | ¥ |
€ | euro | € | € |
© | copyright | © | © |
® | registered trademark | ® | ® |
For a complete list see our HTML Entities Reference.
A related list is our HTML Symbols Reference.
A diacritical mark is a glyph
(little accent) added to a letter.
Some diacritical marks, like grave ( ̀ ) and acute ( ́ ) are called accents
.
Diacritical marks can appear both above and below a letter, inside a letter, and between two letters.
Mark | Character | Construct | Result |
---|---|---|---|
̀ | a | à | à |
́ | a | á | á |
̂ | a | â | â |
̃ | a | ã | ã |
̀ | O | Ò | Ò |
́ | O | Ó | Ó |
̂ | O | Ô | Ô |
̃ | O | Õ | Õ |
Diacritical marks can be placed on alphanumeric characters to produce a new character that is not present in the character set (i.e. encoding) used on the page. Essentially, two characters are combined into one new character.