FURTHER to my earlier article here about Bits, Bytes and Binary I thought I would write an article explaining why you see strange mixtures of the numbers 0-9 and the letters A-F when you are dealing with computers. This is because of a thing called the hexadecimal system of counting.

Yes, I can hear Fred yawning.

In many situations when doing things to do with computers you tend to deal in long strings of the numbers 0-9 and the letters A-F. For example, when entering details of a product key when you purchase a piece of software or sometimes when entering a password for access to a wireless network.

Here is the reason why….

The article referenced above explained the binary (base 2) and decimal (our normal system – base 10) system of counting. It is probably worth refreshing your memory about binary before continuing to read this article.

If people working with computers always used the binary system we would have some very long numbers to deal with. For example, 11111111 in binary is the same as 255 in our normal decimal way of counting.

For this reason we, in the computer industry, use another system of counting called the hexadecimal system. As things to do with computers tend to deal with numbers to the power of 2 (e.g. 2, 4, 8, 16, 32, 64 etc.) it is probably obvious that computer people would pick 16 as a key number in the way we count.

Decimal system

Here is a repeat of the description of the decimal counting system from the earlier article.

Decimal means it is a number system based on 10s. This is the one we all know and love (1, 10, 100, 1000 etc.).

Each digit in the overall number can take on any value between 0 and 9. The rightmost digit is a count between 0 & 9. The second digit from the right is the number of 10s, the third digit from the right is the number of 100s (10 x 10s). The fourth digits from the right is the number of 1000s (10 x 10 x 10s) etc. So for example, 1234 represents 4 + (3×10) + (2×100) + (1×1000) = one thousand two hundred and thirty four.

So 1010 = 0 + (1×10) + (0x100) + (1×1000) = one thousand and ten in the decimal system.

Hexadecimal system

The hexadecimal system is similar to the decimal system. However, each digit of a number counts from 0-15 rather than the 0-9 in the decimal system.

According to one online dictionary definition the term ´hexadecimal´ was coined in the early 1960s to replace the earlier term ´sexadecimal´, which was too racy and amusing for stuffy IBM, and later adopted by the rest of the industry.

In hexadecimal the rightmost digit is a count between 0-15 decimal. The second digit from the right is the number of 16s, the third digit from the right is the number of 256s (16 x 16) , the fourth the number of 4096s (16x16x16), the fifth the number of 65536s (16x16x16x16) etc.

So 111 in binary is 7 decimal (1×4 +1×2 +1×1 = 7). In decimal it is 111 (1×100 + 1×10 + 1×1 = 111). In hexadecimal it is 273 decimal (1×256 + 1×16 + 1 = 273).

There is a problem here about how do you represent the numbers 10 – 15 in a single digit in a hexadecimal number. The answer to this is to use the letters A-F to represent 10-15 decimal. A=10 B=11 C=12 D=13 E=14 and F15.

So in hexadecimal the number 10CF = 4303 in decimal (1×4096 + 0x256 + 12×16 + 15).

One side effect of the hexadecimal system is that I can pretend to be aged 34 if I count my age in hexadecimal. I feel much younger that way.

I hope this article was interesting to some of you and has explained why you see the numbers 0-9 and the letters A-F in various items to do with computers.

Subscribe to the Olive Press

This site uses Akismet to reduce spam. Learn how your comment data is processed.