How to Add a Unicode Character to HTML?

You can add a Unicode character to an HTML document by creating an HTML entity from:

For example, the copyright symbol (©) is represented in the following way:

  • copy — named reference;
  • 169 — decimal numeric reference;
  • U+000A9 — hexadecimal numeric reference.

You can create an HTML entity from any of these in the following ways:

  • © — by adding the named reference between & and ;
  • © — by adding the decimal reference between &# and ;
  • © — by adding the hexadecimal reference between &#x and ;

Things to remember:

  • All HTML entities begin with an ampersand (&) and end with a semi-colon (;);
  • For numeric references (i.e. both, decimal and hexadecimal) you must add a hash (#) after the ampersand (&);
  • For hexadecimal references you must also prefix the hexadecimal number with x to indicate that the numbers that follow should be interpreted as hexadecimal;
  • For hexadecimal references, you may have noticed that U+000 was omitted from the entity. This is because U+ is merely used as a convention to denote that the hexadecimal digits that follow are Unicode code points, and this is never added to the HTML entity. The leading zeros, however, are optional to add.

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.