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.