Useful HTML Character Codes for Bloggers

raccoon-mascot

Most characters can be created with HTML codes. There are three types of HTML codes you can use: decimal, hexadecimal, and friendly codes. It is useful to be aware of these HTML character codes in case you want to write special characters.

Some special characters might display incorrectly based on the geographic location of your blog visitors.

Set Your Blog’s Character Set

To make sure that doesn’t happen, use this line of code in your header.php file in between the <head></head> tags:

This lets your visitors’ browsers know that they should interpret all characters found on your blog based on the UTF-8 (Unicode) character tables.

To read my post about why this is a good thing, click here.

An Example

Let’s take the exclamation mark (!) as an example.

It has an ASCII code of 33.

That means that you can write an exclamation point by writing &#33; in HTML.

The decimal code 33 has a hexadecimal equivalent which is 21. So you can write an exclamation point by the &#x21; code, too. Note the letter x before the number 21. This informs you that it is a hexadecimal number.

But you can also create an exclamation mark by writing the friendly HTML code: &excl;.

To demonstrate these different codes a little bit better, let’s examine the following table.

Decimal, Hexadecimal, and Friendly HTML Codes

Dec Code Hex Code Friendly Code Character
 &#160; &#xA0; &nbsp; SPACE
 &#161; &#xA1; &iexcl; ¡
 &#162; &#xA2; &cent; ¢
 &#163; &#xA3; &pound; £
 &#164; &#xA4; &curren; ¤
 &#165; &#xA5; &yen; ¥
 &#166; &#xA6; &brvbar; ¦
 &#167; &#xA7; &sect; §
 &#168; &#xA8; &uml; ¨
 &#169; &#xA9; &copy; ©
 &#170; &#xAA; &ordf; ª
 &#171; &#xAB; &laquo; «
 &#172; &#xAC; &not; ¬
 &#173; &#xAD; &shy; ­ SOFT HYPHEN
 &#174; &#xAE; &reg; ®
 &#175; &#xAF; &macr; ¯
 &#176; &#xB0; &deg; °
 &#177; &#xB1; &plusmn; ±
 &#178; &#xB2; &sup2; ²
 &#179; &#xB3; &sup3; ³
 &#180; &#xB4; &acute; ´
 &#181; &#xB5; &micro; µ
 &#182; &#xB6; &para;
 &#183; &#xB7; &middot; ·
 &#184; &#xB8; &cedil; ¸
 &#185; &#xB9; &sup1; ¹
 &#186; &#xBA; &ordm; º
 &#187; &#xBB; &raquo; »
 &#188; &#xBC; &frac14; ¼
 &#189; &#xBD; &frac12; ½
 &#190; &#xBE; &frac34; ¾
 &#191; &#xBF; &iquest; ¿

Note

A soft hyphen is visible only when a word is broken up at the end of a line. In such a case it is represented with a hyphen (-).

For a complete table of all available HTML character codes, please click here.

ASCII and HTML Character Table Similarities and Differences

Codes from 32 to 126 in decimal are exactly the same as the standard ASCII codes of those characters.

If you hold down your left Alt key and type 33 on your keyboard’s numeric keypad, you produce an exclamation point. So it is the same as the exclamation point’s HTML codes: &#33; in decimal and &#x21; in hexadecimal.

The rest of the ASCII character table does not match the HTML character table at all. Codes 0-31 and 127-159 in decimal are not used in HTML. The remaining codes (160-255 in decimal) produce different characters than the ones displayed in the standard ASCII table.

For proof of that fact simply compare the above table of HTML character codes with the standard ASCII table.

Liked this post?

Subscribe to our newsletter to receive early notification of new posts and deals:

Next Post »« Previous Post

Leave a Reply

Your email address will not be published. Required fields are marked *