Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com How does the hexadecimal system work?

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 07-06-2004, 06:43 AM PM User | #1 SpiritualStorms Regular Coder   Join Date: Dec 2003 Location: America Posts: 544 Thanks: 0 Thanked 0 Times in 0 Posts 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? __________________ LovesWar
 07-06-2004, 06:48 AM PM User | #2 Willy Duitt Banned   Join Date: Sep 2003 Posts: 3,620 Thanks: 0 Thanked 0 Times in 0 Posts Your not very good at math are you?
 07-06-2004, 06:54 AM PM User | #3 SpiritualStorms Regular Coder   Join Date: Dec 2003 Location: America Posts: 544 Thanks: 0 Thanked 0 Times in 0 Posts 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? __________________ LovesWar
 07-06-2004, 07:19 AM PM User | #4 neofibril Regular Coder   Join Date: Jun 2004 Location: underground Posts: 186 Thanks: 0 Thanked 0 Times in 0 Posts an exercise:
 07-07-2004, 04:49 AM PM User | #5 SpiritualStorms Regular Coder   Join Date: Dec 2003 Location: America Posts: 544 Thanks: 0 Thanked 0 Times in 0 Posts So is anyone gonna answer my question? Is it 16 times 16? __________________ LovesWar
 07-07-2004, 06:49 AM PM User | #6 JohnKrutsch Regular Coder   Join Date: Jun 2002 Location: The Planet Earth Code Poet: True Posts: 282 Thanks: 0 Thanked 1 Time in 1 Post They all ready did. The link that neofibril supplied more than adequately explained how The Hexadecimal Number System works. And yes 16*16=256
 07-07-2004, 07:06 AM PM User | #7 SpiritualStorms Regular Coder   Join Date: Dec 2003 Location: America Posts: 544 Thanks: 0 Thanked 0 Times in 0 Posts 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. __________________ LovesWar
 07-07-2004, 08:15 AM PM User | #8 Garadon Regular Coder   Join Date: Jul 2002 Posts: 698 Thanks: 0 Thanked 0 Times in 0 Posts 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.
 07-07-2004, 02:21 PM PM User | #10 nolachrymose Regular Coder   Join Date: Jun 2002 Posts: 338 Thanks: 0 Thanked 0 Times in 0 Posts 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!
07-07-2004, 02:38 PM   PM User | #11
dumpfi
Regular Coder

Join Date: Jun 2004
Posts: 565
Thanks: 0
Thanked 18 Times in 18 Posts
Quote:
 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

Quote:
 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.

Quote:
 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

Quote:
 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

Quote:
 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

Last edited by dumpfi; 07-07-2004 at 02:56 PM..

07-07-2004, 03:16 PM   PM User | #12
trib4lmaniac
Regular Coder

Join Date: Feb 2004
Location: Cornwall, UK
Posts: 535
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
 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!

07-07-2004, 03:21 PM   PM User | #13
dumpfi
Regular Coder

Join Date: Jun 2004
Posts: 565
Thanks: 0
Thanked 18 Times in 18 Posts
Quote:
 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

 07-07-2004, 03:46 PM PM User | #14 trib4lmaniac Regular Coder     Join Date: Feb 2004 Location: Cornwall, UK Posts: 535 Thanks: 0 Thanked 0 Times in 0 Posts You know what I mean
07-08-2004, 01:35 AM   PM User | #15
SpiritualStorms
Regular Coder

Join Date: Dec 2003
Location: America
Posts: 544
Thanks: 0
Thanked 0 Times in 0 Posts
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.

Quote:
 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.
__________________
LovesWar

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 04:15 AM.