Converting Binary to Hexadecimal is easy, once you know the technique. I will dispense this technique... wait for it... now:

First, write your binary number down. It's easiest that way.

10110010
Now, divide that number into groups of four numbers:

1011 0010
Now, with each of these groups, write numbers underneath the letters, from RIGHT TO LEFT. These numbers start with one, and double each time, i.e. 1 2 4 8. Now you should have:

1011 0010
8421 8421
Now, for each digit, multiply the top digit by the bottom digit, and write it underneath, like this:

1011 0010
8421 8421
8021 0020
that is, if the binary digit it one, you write the number. If it's 0, you write 0.

Now, on the bottom line, for each group of four numbers, add them up:

8021 0020

8 + 0 + 2 + 1 = 11
0 + 0 + 2 + 0 = 2

  11    2
Now, as you probably know if you care enough to read this far, Hexadecimal has sixteen numbers. Here they are, with their decimal equivilents:

Dec - Hex
0 --- 0
1 --- 1
2 --- 2
3 --- 3
4 --- 4
5 --- 5
6 --- 6
7 --- 7
8 --- 8
9 --- 9
10 -- A
11 -- B
12 -- C
13 -- D
14 -- E
15 -- F
Now, take any numbers that are above nine and put in their letter, i.e.

11   2
B    2
Now, take all the letters and numbers on the bottom line and put them togther in one number:

B2 

And blammo, Binary to hexadecimal. With a bit of practice, you can learn to do this in your head. Here are some more examples, to outline some other points:

Firstly, if the number of Binary digits doesn't divide into four nicely, add 0s onto the START until it does. Example:

 1011101 changes to
01011101 then proceed as normal:
0101 1101
8421 8421
0401 8401

0 + 4 + 0 + 1 = 5
8 + 4 + 0 + 1 = 13

   5   13
   5    D

5D
Here is one final example, with comments that some people think are easier to follow:

Original Binary:            1101011010001
Add '0's:                   0001101011010001
Divide into little groups:  0001 1010 1101 0001
Write down 8421s:           8421 8421 8421 8421
Multiply:                   0001 8020 8401 0001
Add the groups of 4 up:        1   10   13    1
But in letters if needed:      1    A    D    1
Result:                                    1AD1
And that, my friends, is how we convert binary to Hex. Next, I'll write up Binary to Octal.

Here's a different (and IMHO quicker/easier) way to do it. First you'll need a chart comparing binary and hex values:

--------------------------------------
|   Binary   |   Hexadecimal   |
--------------------------------------
|    0000    |              0              |
|    0001    |              1              |
|    0010    |              2              |
|    0011    |              3              |
|    0100    |              4              |
|    0101    |              5              |
|    0110    |              6              |
|    0111    |              7              |
|    1000    |              8              |
|    1001    |              9              |
|    1010    |              A              |
|    1011    |              B              |
|    1100    |              C             |
|    1101    |              D             |
|    1110    |              E             |
|    1111    |              F              |
--------------------------------------

Ok, now, say you've got a binary number: 101100101100. Starting from right to left, divide the number into segments, each containing 4 numbers. Which will give you: 1011, 0010 and 1100. Then, look at the chart and find the hexadecimal values for each of those binary values:

                           ---------------------------------
Binary               |  1011  |  0010  |  1100  |
                           ---------------------------------
Hexadecimal  |     B      |     2      |     C     |
                           ---------------------------------

Then, just remove the spaces inbetween the hexadecimal values, and voila!, you've got your hexadecimal equalvalent of the binary value you started with.

101100101100B = B2CH


I'd like to give a shout out to dann's E2 Offline Scratchpad for helping to make those charts.

Log in or register to write something here or to contact authors.