Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

1. ## How does the hexadecimal system work?

I have been thinking for a while as to how the 6 digit system for the hexidecimal works. I dont get how it is that one can get 256 colors from merely 6 digits. If i take a calculator, and i multiply 6 times 16, i get only 96 different potential variations, so how can that be the same as 256? I know theres 0 through 9, and from there, its like A through F for anything higher than 9. Thus, i know that #000000 is like pure for pure black. For white, its #ffffff. But i do not get from this, how it is that it can be 256 colors.

Can anyone lend a hand, or an explanation?

• Your not very good at math are you?

• LOL............never been my greatest skill. I am a visual person, so i try to visualise concepts so that i may understand them. If i however multiply 16 times 16, then i get 256. Is that how its supposed to be?

• ## an exercise:

• So is anyone gonna answer my question? Is it 16 times 16?

And yes 16*16=256

• I didnt really understand the excercises. I get the idea of how the letters represent higher digits than 9, but over, and beyond that, i didnt get a friggin thing. I need things broken down before i get things.

• the hexadecimal system works just like the normal 10 base system.
the first hex on the left of a number is 1's so a number with only 1 digit can be between 0 and 15(f):0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
the next digits is then increased for every time you have 16 or more of the digit before it so 16 would be :16=#10,17=#11,18=#12.

a color code hex number is infact not 1 number but 3hex numbers.
2 digits for red
2 digits for green
2 digits for blue

each number can be between 0-255. this can be calculated by saying that you can store 16 sixteen times with to digits 16x16=256 but since 1 number i zero the range is 0-255.
each of the 3 numbers(red,green,blue) indicates how much of that color to put in the final color. And as standard it was decided in the way way past that a 0 of all three(#00{red}00{green}00{blue} should black and a full of all 3(#ff{red}ff{green}ff{blue}should be white.
And contrary to what you said this system allows for 256^3 different colors not just 256 colors.

Hope that helped.

• See what kills me is the idea of a set. I know that 10 is really 16, since f is 15. In this sense, the one is for a single set, while, the zero is for nothing left over.

This is ok up until i get to something like 26. If i say, its 2 sets, plus a 6, then i would be inclined to think, ok, thats 30 plus 6, which is 36, but that isnt correct either. Hence, from my perspective, there isnt an easy way of using a formula in my head by which to easily figure out how to go from regular math notation to hexadecimal notation.

For something like FF, i know the answer is 240 plus 15, since the first letter means 15 times 16, which gives us 240. The second F means 15, so when you add 240 plus 15, you get 255. But i dont see how to apply a consistant formula all accross the board. This is why i dont fully get it.

How do i break something like, 24 for red, 26 for green, and 24 for blue. How do i break down into their hexadecimal equivalents? In other words, how do i do it automatically in my head without having to like count with my toes. If i write everything down, then yea, i could figure out. But i dont always want to have to write things down.

At any rate, if in human terms the number is 24, i add 6 to get 30, which would be the hexadecimal equivalent. But if the hexadecimal is like lets 56, then i subtract 6, and i get 50, for the human notation version of the number.

Somehow, anything after F, you have to add a 6 to get an idea of the hexadecimal equivalency. 14 then is like 20 since i have added a 6. But how do i figure out something like 35 in hexadecimal notation? I subtract, right? and i subtract 6 since, the differences between regular sets, and hexadecimal sets is 6. If you go from human notation to hexadecimal, you add a 6, but if you go from hexadecimal to human, you subtract a 6.

But how do i do an easy translation of something like BB? Or ED? What B= 11, but how then do i understand the 11? If i had to just do math, i would probably be inclined to just ad 6, but that isnt correct since the 11 here means 11 sets of something, which is 16. This being the case, i know then that i multiply 11 sets times 16 to get 176; and from here, we add another 11 for the second b to get the final answer of 187?

I am not sure i am phrasing my problem. i know that the second digit generally presents a set, hence, 10 means a whole set of 15---if the 10 here in the hex system, and not in the human system. In the human system, 10 is anything over 9, but in hex, its anything after F, which is 16. But supposing i was already in the hex system: how would i do 255? Do i simply subtract 6 to get 249? Is this correct? 249 is the human version of the hex system of 255?

• It's all about place values. But just to preface, it doesn't make sense to call the decimal system the "human" system. Hexadecimal is just as much a human base as decimal.

When you have a number in decimal, say, 456, each digit represents a place value. Here, "6" is the "units" digit (1), so you multiply 6*1. Then, "5" is the "tens" digit (10), so you multiply 5*10. Then, "4" is the hundreds digit (100), so you multiply 4*100. The sum of these products is equal to the number itself.

The reason we do this is because each digit is "mapped" to a power of ten, starting from 0. The "6" is in the place value 10^0, or 1. The "5" is in the place value 10^1, or 10. The "4" is in the place value 10^2, or 100.

What does this mean in terms of hexadecimal, though?

When you use a different base system, it's very simple to convert to decimal. All you do is switch the base in the above example to the base you are using (in your case, 16). So, for instance, if we have the number 255 in hexadecimal, the conversion process to decimal would be this:

5 * 16^0 = 5*1 = 5
5 * 16^1 = 5*16 = 80
2 * 16^2 = 2*256 = 512

Then, we take the sum (5 + 80 + 512) and we get 597. That is the decimal value of the hex. number 255.

Hope that helps!

Happy coding!

• Originally Posted by SpiritualStorms
This is ok up until i get to something like 26. If i say, its 2 sets, plus a 6, then i would be inclined to think, ok, thats 30 plus 6, which is 36, but that isnt correct either.
26 => 2 full sets + 6 left over => 2 * 16 + 6 = 38

How do i break something like, 24 for red, 26 for green, and 24 for blue. How do i break down into their hexadecimal equivalents? In other words, how do i do it automatically in my head without having to like count with my toes. If i write everything down, then yea, i could figure out. But i dont always want to have to write things down.
Use a calculator, if you aren't good enough in multiplication and addition.

But if the hexadecimal is like lets 56, then i subtract 6, and i get 50, for the human notation version of the number.
(hex) 56 => 5 full sets + 6 left over => (dec) 5 * 16 + 6 = 86
(dec) 86 => FLOOR(86 / 16) full sets + 86 % 16 left over => (hex) 5 * 10 + 6 = 56

But how do i do an easy translation of something like BB? Or ED? What B= 11, but how then do i understand the 11? If i had to just do math, i would probably be inclined to just ad 6, but that isnt correct since the 11 here means 11 sets of something, which is 16. This being the case, i know then that i multiply 11 sets times 16 to get 176; and from here, we add another 11 for the second b to get the final answer of 187?
BB => 11 full sets + 11 left over => 11 * 16 + 11 = 187
ED => 14 full sets + 13 left over => 14 * 16 + 13 = 237

But supposing i was already in the hex system: how would i do 255? Do i simply subtract 6 to get 249? Is this correct? 249 is the human version of the hex system of 255?
255 => 2 full sets of full sets + 5 full sets + 5 left over => 2 * 16 * 16 + 5 * 16 + 5 = 597

dumpfi

• Originally Posted by SpiritualStorms
If i take a calculator, and i multiply 6 times 16, i get only 96 different potential variations
lol... that's a far cry from the 16 and a half million combinations available!

• Originally Posted by trib4lmaniac
lol... that's a far cry from the 16 and a half million combinations available!
Actually, 6 times 16 is 96.

Next time he should try 16^6.

dumpfi

• You know what I mean

• I realise that. All languages are human made, hence human based. However, because some times one needs to create distinctions for effective communication, i chose a set of terms that would contrast the 2 for easier references.

from: nolachrymose,
It's all about place values. But just to preface, it doesn't make sense to call the decimal system the "human" system. Hexadecimal is just as much a human base as decimal.
It helps some times when one uses gimmick like thought structures to differenciate one thought from another.

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•