Character References

Need for Character References

There are times where we will want to include characters like quotes(‘ or “), angle brackets( < or >) or ampersand(&). These symbols have special meaning in HTML and cannot be included directly. They have to be included using entity character references. The general format is:


&name;

&#number;

A symbol can have a unique name or number or both. Anyone of the two methods can be used. Generally, the support for numbers is better than support for names in older browsers.

Symbols used in HTML

Result Description Entity Name Entity Number
non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
double quotes &quot; &#34;
single quotes (apostrophe) &apos; &#39;

<p> Tom &amp; Jerry</p>

Common Symbols

In some situations we may also want to add symbols like copyright and trademark. They can also be added using the same methods.

Result Description Entity Name Entity Number
© copyright &copy; &#169;
® registered trademark &reg; &#174;

If you want to know about the entire list of symbols you can read the Wikipedia article on HTML and XML entity character references.