Search This Blog

Monday, October 10, 2005

Binary to Hex values for dummies...

Binary to Hex values for dummies...

I tend to get questions about Hex pretty often. So I thought – why not write something short to get people to understand more about hex?
Since I’m stuck at the hotel bar, now would be the perfect time to do it! :)

Prereq – you should know how binary values work.

You all know that hex uses letters (A-F), which is mind-boggling in itself. But if you think about it, it’s rather simple:
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

Since hex will use four bits and give it a value it only goes up to F, why? Cause 1111 in binary equals 15 (8+4+2+1). Now you might think – Hey, that’s simple! What’s all the fuzz about? Well, as everything fun in life – there are exceptions. But I will not go into that now, just accept that and read on ;)

Ok, how can I use hex to make binary easier (shorter)?
Let’s take an example, if I want to write the binary number 1010 in hex I simply convert it to decimal which is 10 thus is the binary number 1010 the same as A in hex.

Let’s make it more interesting, lets say I have this binary number 00111101. So first we break it down into this 0011 – 1101 which gives us 3 and 13 converted to hex that would be 3d, starting to get the idea?

So now the final imaginary example:
1111011001110001100011001111 – once again I break it down into clusters:
1111 = F, 0110 = 6, 0111 = 7, 0001 = 1, 1000 = 8, 1100 = C, 1111 = F so the answer would be:

So, now you know how to take binary values and convert them into hex values. End of lesson 1 :)

Ps. You can also do it in reverse order if you want. And if you want to be a real geek, then use the ASCII table to write words ;) Ds.



Kurt Berg said...

Hi Jimmy! Have you tried to order in binaries yet? If so what did you get? :-)


victoria said...

I have been trying to learn hex for 3 days now! 10 minutes on your site and hey presto...!

Thankyou soooo much for creating this!!


Jimmy Andersson [DS & Security MVP] said...

Hey, I'm glad to be of some assistance! :)

Have fun with Hex! :)


Chelsea said...

this made it soo muxh easier for me. i'm taking a computer class and trying to do conversions and i was very confused. still trying to figure out how d+3 equals 10 according to the instruction packet me professor gave me...

DeMarco said...

d+3 is 16 u mean d-3 which IS 10