# Introduction

If you work with computers on some level beyond Microsoft Office or browsing the net, at some point, you will run across hexadecimals. What are they and why do people bother using them when they seem something better left for assembly programmers?

Hexadecimal is just a base-16 number system. Because we grew up in a society where most of us has 10 fingers, we use the base 10 decimal system for the most part. In hex, in addition to the numerals 0-9 to represent values zero through nine, we also have letters A-F to represent values ten through fifteen.

# The Nitty Gritty

Consider the number 10995. In decimal system, we have
(1 x 10^4) + (0 x 10^3) + (9 x 10^2) + (9 x 10^1) + (5 x 10^0) = 10995

In hexadecimal system, we have 2AF3:
(2 × 16^3) + (10 × 16^2) + (15 × 16^1) + (3 × 16^0) = 2AF3

What’s important is to realize that numbers are abstract counting notions which can have infinite ways of displaying in reality. Actually, base 10 really offers no advantage to us except that we humans are born with 10 fingers and toes which make it easier for us to count. We could use base-23 or base-159 for no good reason.

1. You can store more information in the same space. In a hex code with two digits you can express the numbers 0 through 255. In a decimal code with two digits you can count from 0 to 99.

2. Hexadecimal (base 16) converts easily to binary (base 2), which is used by computers at the fundamental level. A two digit hexadecimal number can range from 0 to 255, which can be expressed in eight digits of binary code.

Programmers sometimes like to throw around dorky jokes that ordinary people won’t get. The following is a good test to see how dorky you are:

3×12=36
2×12=24
1×12=12
0x12=18

Programmers typically put 0x in front of a number that’s in hex base. This way, people don’t get confused. So here, the first three lines are interpreted as multiplication while the last is considered the hex interpretation of 12, which is (1 x 16^1) + (2 x 16^0) or 18.

## Here’s a better one

Q: Let’s say only you and dead people can read hex. If you teach your buddy how to read hex also, what do you all have in common?
A: You are all deaf.

If you need an explanation, you’re still not quite a dork. Work on it though! Still, for completeness, explanation: “dead” refers to a hexadecimal number DEAD (57005 base 10), as opposed to the state of not being alive. With you and your friend, that’s two more to the group, so add 2 to D to get F. Hence, DEAD + 2 = DEAF.

# Conclusion

In conclusion, understanding the hexadecimal system can give you a powerful understanding of how computers operate and also enable you to work on a number of relevant areas such as:

• Web design with the hex color codes
• Patching software with hex editors
• Reverse engineering software
• Anything else in the world you feel like counting in base 16 versus base 10.