HTML Introduction | HTML Text Elements | Entity

HTML has several predefined characters. These are called HTML reserved characters. If you use these reserved characters directly in HTML code, the web browser interprets them with a special meaning instead of their normal character meaning. An entity is a separately defined character set that lets you display HTML reserved characters with their original meaning.

An entity has the following form.

Syntax

&entityName;
or
&#entityNumber;

The following example shows how a web browser interprets angle brackets (<>) when they are used in HTML code.

Example

<p>&lt;h2&gt; is a tag that represents the second-largest heading.</p>
<p>&lt;p&gt; is a tag that represents a paragraph.</p>

Run code

As shown above, angle brackets (&lt;&gt;) used in HTML code are interpreted as the start and end of an HTML tag.

Entity names are case-sensitive.

Common entities provided by HTML are as follows.

Entity character Entity name Hex entity number Description
&nbsp; &#160; non-breaking space
< &lt; &#60; less than
> &gt; &#62; greater than
& &amp; &#38; ampersand
" &quot; &#34; double quotation mark
' &apos; &#39; single quotation mark

For more information about all entities available in HTML, see the official W3C site.

Character entity references in HTML

Diacritical marks

A mark that indicates pronunciation is called an accent. These accents are not used on their own. They are usually used together with another character. To represent them accurately, HTML provides separate diacritical marks like the following.

Common diacritical marks provided by HTML are as follows.

Diacritical mark Character Hex entity Result
̀ a a&#768;
 ́ a a&#769;
̂ a a&#770;
 ̃ a a&#771;
 ̀ O O&#768;
 ́ O O&#769;
̂ O O&#770;
 ̃ O O&#771;

Example

<p>The pronunciation symbol for j with an accent is [j&#769;].</p>

Run code

Symbol special characters

In addition to HTML reserved words, you can use symbol special characters to represent characters that cannot be typed from the keyboard. These symbol special characters include mathematical terms, Greek letters, and international currencies.

Common symbol special characters provided by HTML are as follows.

Symbol special character Entity name Hex entity Description
¢ &cent; &#162; cent
£ &pound; &#163; pound sterling
¥ &yen; &#165; yen
&euro; &#8364; euro
© &copy; &#169; copyright
® &reg; &#174; registered trademark
× &times; &#215; multiplication
÷ &divide; &#247; division