Skip to content
Related Articles

Related Articles

What is character entities in HTML ?

Improve Article
Save Article
  • Last Updated : 20 Aug, 2021
Improve Article
Save Article

In this article, we will learn about HTML character entities and how to use them. HTML character entities are basically a set of characters (entity) used to represent few characters reserved by the HTML, especially invisible characters or characters difficult to type out using a regular keyboard. HTML provides some entity names and entity numbers to use these symbols. Please refer to HTML Entities for more details about characters.

Example: ‘<‘ is already reserved in HTML language. Sometimes this character needs to display on the web page that creates ambiguity in code. Along with these are the character which is normally not present in basic keyboard ( £, ¥, €, © ), etc. We will explore the HTML entities in detail as we grow in the article. 

Syntax:

&entity_name; or &#entity_number;

Some useful symbols with their entity name and entity numbers are discussed below:

Symbol

Entity Name

Entity Number

Details

  & &#160; non-breaking space
< &lt; &#60; less than
> &gt; &#62; greater than
® &reg; &#174; registered trademark
© &copy; &#169; copyright
  &#8377; India rupee sign
&euro; &#8364; euro
¥ &yen; &#165; yen
$ &dollar; &#36; dollar
£ &#163; pound
¢ &cent; &#162; cent
&apos; &#39; single quotation mark (apostrophe)
&quot; &#34; double quotation mark
& &amp; &#38; ampersand

Reserved Characters: Reserved characters are those characters that are either reserved for HTML or those which are not present in the basic keyboard.

Example: As Entity numbers are easy to learn. Here, a few of the reserved characters are discussed:

Reserved Character

Entity Name
& &amp;
< &lt;
> &gt;
&quot;

Other Characters: Some characters that aren’t available directly on our keyboard, therefore such an entity can be used to represent it by using their entity number. 

Example: These keywords are directly not available to type, we need to specify their entity number. Here #x before the numbers represents the hexadecimal representation. 

Character Entities
&#8805; &#x2265; &GreaterEqual;
© &copy; &#169;
&euro;  &#8364;
&#8707; &#x2203; &exist;

Example: 

HTML




<!DOCTYPE html>
<html>
  <head>
    <title>HTML Character entities</title>
  </head>
  <body>
    <h3>Indian rupee sign = ₹</h3>
    <h3>Euro sign = €</h3>
    <h3>Dollar sign = $</h3>
    <h3>Pound sign = £</h3>
  </body>
</html>


Output: 

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!