What Is "Hexadecimal" Anyway?

Computer people are weird, at least to many non-computer people. Computer people sound like they don't speak the same language, and they sometimes even count differently, for heaven's sake. Instead of just using the numbers 0 through 9, they sometimes use just 0 and 1 (called binary) and sometimes use a mixture of number and letters (called "hexadecimal" or "hex" for short).

The latter looks really odd when written down - for example the decimal number 26 is the same as the binary number "11010", or the hex number "1A". What?? Yep.

Wait, wait, wait - why are we even using 0's and 1's, and sometimes letters of the alphabet? Binary numbers (the 0's and 1's) are a good way to show how a computer counts and works. Digital computers (the kind we use every day in smartphones and so on) can only really perform their complex calculations by manipulating patterns of ones and zeros.

They can't even count to ten like a first grader might, unless they add up all the ones and zeroes. We count in tens most likely because most of us have ten wiggly bits attached to the ends of our arms. It's easy to use fingers and thumbs as markers when counting. Computers lack the wiggly bits - but they have gazillions of microscopic on/off switches to work with, representing either "0" (off) or "1" (on).

When we "run out" of fingers, we stick a one in front of the number and start over - so the number after 9 is 10 (ten plus zero), then 11 (ten plus one), etc. This is the decimal number system.

Binary is counting with just two digits, zero or one. After you count to one, you need to stick a 1 in front of it to represent the decimal number two (two plus zero). Add one again and you have the decimal number 3 (two plus one). It might make more sense written out:

0000  = 0
0001  = 1 ... then we stick a "1" in front to proceed 
0010  = 2 
0011  = 3
0100  = 4
0101  = 5  ... and so on.

Hex would be counting if you had 8 digits on each hand instead of 5 - so you can count up to 16 before adding a one in front of it to proceed. Since we don't have single numbers representing 11, 12, 13, etc, we use the first few letters of the alphabet:

9   = 9
A  = 10
B  = 11
C  = 12
D  = 13
E  = 14
F  = 15  ... then we stick a "1" in front to proceed
10 = 16
11 = 17
12 = 18  ... and so on

Okay, but why do computer folk use hexadecimal numbers anyway if we have binary? Mostly because large binary numbers get very cumbersome, very quickly. It's much more readable to represent a computer friendly number in hex than it is binary.

For example, one million (decimal) in binary is:


but in hex , it is:



No comments :