How to Display Special Characters in HTML

In this tutorial you will learn how to display special characters in HTML through HTML character entities.

There are several html special characters that are reserved for its own syntax or otherwise, for example the less-than sign cannot be directly used in your content or paragraphs. The less-than sign is mistaken as an opening of a tag by the browser. Similarly typing as many consecutive spaces between two words in HTML produces only 1 space on the browser. All of that is overcome by HTML character entities.

Step # 1 – Character entity syntax

In order how to display html special characters, Each character entity follows one simple format as shown below.


The ampersand sign tells the browser that the following is an entity name. This in turns guides the browser to display the appropriate character entity on the screen.

Step # 2 – Using less-than character entity

Now that you know the pattern an entity is written in, we should move on to produce some results. Following is the code to show x is less than y by declaring the less-than character entity:
x &lt y

The browser interprets this character entity as a declaration for a less-than sign and doesn’t count it as an opening of an HTML tag.

Using the less-than sign character entity

Step # 3 – Using non-breaking space character entity

The non-breaking space character entity is used where multiple consecutive spaces are needed to be placed. The number of spaces printed by the browser depends upon the number to consecutive non-breaking space character entity declarations. The code below declares two consecutive spaces in the text:

This is a &nbsp &nbsp text

Result for the non-breaking space character entity

Step 4: List of characters in HTML

In the browser result, you should notice, that the normal space characters before, in between, and after the &nbsp entity are also considered as space. This is because these entity calls are individual items in HTML, and the browser allows one space character to be printed after and before every item. Thus the above code should produce 5 spaces; 1 normal space, then 1 for the character entity, and so on…

Below is a list of commonly used character entities in HTML.

Result Description Entity Name
non-breaking space &nbsp
< less than &lt > greater than &gt
& ampersand &amp
¢ cent &cent
£ pound &pound
¥ yen &yen
€ euro &euro
§ section &sect
© copyright &copy
® registered trademark &reg
™ trademark &trade

And that’s pretty much it for how to di