style = “font-color:#FF33CC“>
When you are working with computers, and especially the Internet and the Web, you will eventually run into things like the above – – – Hexadecimal (HEX) Numbers.
In HTML and other programming/scripting languages these represent a color for display on-screen. If you are building a website and you want a certain color text on the page, for example, you will need to use the appropriate color code or HEX code to make that happen.
The following will not pretend to make you a Hex math genius, but we will explain just what those funny letters mean.
When people evolved, they did so with ten fingers. (Yes we do have a few folks down in Horsepasture with 11 fingers and 12 toes, but that’s social commentary, not math.)
Since we have ten fingers, and since early man probably used them as the first counting device, we learned to count in TENs. DECI, Latin for Ten, gave birth to the term DECImal.
Decimal numbers are based on POWERS of Ten.
Since everything is based on Tens, we only need Ten Digits to represent every possible number.
1, 2, 3, 4, 5, 6, 7, 8, 9, 0
So, let’s start counting up from Zero in Decimal and see how it works . . .
0-1-2-3-4-5-6-7-8-9-? OOPS – We’re Out of Digits!
Since we ran out of digits, we need to do a bit of trickery to represent numbers higher than 9.
What we do is start over with Zero as the right most digit, and put a One (1) to it’s left of it: 10 – 11 – 12 … 18 – 19 – etc.
We keep doing this until we run out of digits again at 19. We start over at Zero on the right, and increase the digit to its left by One.
Note: The Romans had no number for, or possibly didn’t even have the the concept of Zero
The “Decimal Place Holders” are all Powers of Ten
The right-most digit tells us how many ONES are in the number.
The next digit to the left tells us how many TENS, the next, how many HUNDREDS, etc.
How the Average Brain “Decodes” a Decimal Number
Let’s take the number 14,728
To “Decode” this number, the brain subconsciously goes . . .
There is One Ten Thousand, Four One Thousands, Seven One Hundreds, Two Tens and Eight Ones.
Add them all together and you get 14,728
That’s how modern number systems work!
Your brain does all of the above decoding automatically and easily since everyone Knows their “Tens”
A fact, A question and A Conclusion.
Fact: For reasons best left to people with Pocket Protectors and no personal skills, computers like to “Think” in groups of EIGHT digits instead of Ten.
Question: What if people had evolved with Eight fingers per hand instead of Five?
Conclusion: We would have developed a number system based on powers of Sixteen rather than powers of Ten
THAT is exactly what the HEXadecimal number system is, a number system based on Sixteen and not Ten.
Hexadecimal (Hex) Numbers are based upon Powers of 16
Let’s start counting upwards from Zero in Hex . . .
0 – 1 – 2 – 3 – 4 – 5 – 6 – 7 – 8 – 9 – ? OOPS – We’re out of Digits again.
This time, however, we don’t do the add a Zero and scoot stuff over until we get to 16.
Q: But where do we get the additional numbers beyond Nine so we can keep counting?
A: We Don’t – we use the letters A through F as if they were numbers.
See the chart below.
The first Twenty Hexadecimal Numbers Are: 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13 14
Let’s Decode the Hex Number F2A4C Which Equals Decimal 993,868
How the Nerd Brain (or more likely, calculator) Decodes a Hex Number
To “Decode” this number, the nerd brain consciously thinks like this:
IF YOU’RE LOST, DON’T FRET OVER IT!
There’s no need to take pencil in hand to figure this stuff out.
Should you ever have the need to convert one to the other, you’ll find handy Hex/Decimal calculators included with Windows, Mac OS and Linux. Shown above is the Windows Advanced Calculator.
Also, at the moment, it’s only important that you have a passing familiarity with this (and the Binary – Powers of Two) number system.
Let’s Examine a Typical Web Browser Color Code.
color = “#FF33CC“
In our discussion of Hexadecimal Color Codes we explained that the above is called a TRIPLET, or group of THREE Numbers. (FF, 33 and cc)
Colors are specified by how much RED (from Zero to 255), Green (from Zero to 255) and Blue (from Zero to 255) are in the final color.
We must, however, specify these color values in Hex, because that’s what computers (or at least Web Browsers) understand.
FF 33 CC Is Therefore . . .
FF (Hex) = 255 (Decimal) Points of Red (All the Red There Is)
33 (Hex) = 51 (Decimal) Points of Green
CC (Hex) = 204 (Decimal) Points of Blue
The Result Is This Color
Again please let me state that in the beginning, you only need a passing familiarity with these number systems.
At least you should no longer be intimidated when some piece of software asks you to enter something in Hex.
Interesting Fact: The fact that computers use alternate number systems explains why 1K (1000) in Computerese is REALLY 1,024 and 4K (4000) is Really 4,096. We’re NOT working with even powers of Ten, but powers of Two