Special characters and symbols with HTML Entities | Codes

In this tutorial , we are going to learn how to use HTML entities to display special characters and symbols on your web page.

Let’s begin the tutorial with defining what entities are. There are many characters reserved in HTML which we cannot directly use by text because of various reasons like, maybe the character is not present in the keyboard or the character maybe part of the markup language.

To display such special characters we use character entities. These entities enable you to use the characters that cannot be expressed in the document’s character encoding or that cannot be entered by a keyboard.

Entities represent arrows, letters, currencies, mathematical operators, numbers, punctuation marks, symbols, shapes and many more. Two of the most extensively used characters are a copyright character – © or a heart symbol – ♥

An entity begins with “&” ampersand sign and ends with a “;” semicolon. And in between & and ; we can write entity name, hexadecimal code or a decimal code depending on the character you want.

Some frequently used entities are listed below:

Output Description Entity Name Entity Number
non-breaking space    
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
double quotation mark &quot; &#34;
single quotation mark (apostrophe) &apos; &#39;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
euro &euro; &#8364;
© copyright &copy; &#169;
® registered trademark &reg; &#174;

Numerical references have browser support and can be used to specify any Unicode character, on the other hand entities are limited to a subset of this.

We don’t need to add any extra libraries to access these characters. And entities are strings because of which we can apply different implementations like HTML, CSS and JavaScript.

There are hundreds of entities available and you can always search on the web whenever you are stuck on some character that’s new to you.

Hope you have understood what entities are.

Leave a Comment