HTML entities
There is so much text on so many webpages across the web, and some of this text happens to be special characters that do not appear on a keyboard. How then, to go about including such characters on webpages?
This lesson focuses on:
- What is an entity?
- Entity construction
- Common entities
- Reverse entities
What is an entity?
An entity is a special code that will display certain characters on webpages. With entities you can display things like the copyright symbol ( © ), the trademark symbol (™), the ampersand symbol (&), and more.
Entity construction
Now that you what entities are, how do you go about using them?
An HTML character entity has three parts:
- An ampersand ( & )
- An entity name or a # sign and an entity number
- A semicolon ( ; )
For example, to display a greater than sign on a webpage, we would write > or >
Output:
NOTE: While you can use names or numbers for character entities, it is better to use names because they are easier to remember than numbers.
NOTE: Entities are case sensitive!
Common entities
There are many entities you can use, and within the set of available entities, there is a set of very commonly used entities.
Common character entities and what they will display:
| Entity Name | Entity Number | Character | Output |
|---|---|---|---|
| |   | space | |
| < | < | less than sign | < |
| > | > | greater than sign | > |
| & | & | ampersand | & |
| " | " | quotation mark | " |
| ' | " | apostrophe | ' |
| © | © | copyright symbol | © |
| ® | ® | trademark symbol | ® |
| × | × | multiplication symbol | x |
| ÷ | ÷ | division symbol | ÷ |
Example using some of the common entities:
Output:
For a full list of HTML character entities, read our HTML character entities reference page.
Read more about text formatting in our HTML text formatting 1, HTML text formatting 2, and HTML text formatting 3 lessons.
Reverse entities
What if you wanted to print the code for an entity on a webpage instead of the character itself?
Remember that every entity begins with the & symbol, and how do we display this symbol? By using the & entity. So to display the code for an entity on a webpage instead of the character itself, simply use & to produce an & symbol followed by the rest of the entity code.
Example:
Output:




