Using HTML Entities - dummies

By Andy Harris

HTML is a terrific tool for writing documents, but every once in a while, you come across a character that can’t easily be printed in HTML. For example, what if you’re writing about math and you want to use the less than (<) symbol? HTML normally interprets the less than symbol as the beginning of an HTML tag.

Likewise, you might find yourself wanting to use the yen sign, adding an inverted exclamation point for text written in Spanish, or some other unique character.

HTML has a special feature for adding these characters, called HTML entities. An HTML entity is a special code embedded in a website. When the browser sees the code, it replaces it with a special character.

All HTML entity codes begin with the ampersand (&) and end with a semicolon (;). In between is a text code describing the particular symbol. For example, use x &lt; 5 to create the output x<5.

In addition to the shortcut, you can use the ASCII/Unicode equivalent to print most characters found in the standard ASCII or Unicode (ISO-9959-1) character sets. The less than symbol is also ASCII character 60, so you could also use this as well: x &#60; 5.

All HTML-compliant browsers are required to support the following entities, which are all reserved characters in HTML.

Character Entity ASCII/Unicode
&quot; &#34;
& &amp; &#38;
&apos; &#39;
< &lt; &#60;
> &gt; &#62;

Most modern browsers support many other HTML entities as well. Here are a few other symbols you might want to use:

Entity Character
&nbsp; Non-breaking space. Forces a space.
&iexcl; Inverted exclamation point (¡)
&iquest; Inverted question mark (¿)
&cent; Cent sign (¢)
&pound; Pound sign (£)
&yen; Yen sign (¥)
&copy; Copyright symbol (©)
&reg; Registered trademark (®)
&deg; Degree symbol (°)
&times; Multiplication symbol (×)
&divide; Division symbol (÷)

You can find a full list of HTML entities at