Binary Numbers Part 2

February 2, 2009

 

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

Converting Binary to Hexadecimal…

 

1 10 – A

211 – B

3 12 – C

4 13 – D

514 – E

615 – F 

You’ll typically see hexadecimal numbers preceded by 0x, it just means that the number is hexadecimal, but the actual 0x is irrelevant to the number. So 0×42FE means that 42FE is a hexadecimal number, we know that because of the 0x, ignore the 0x when you’re actually working with the number.

Converting from binary to hexadecimal is very easy, you first separate the binary number into 4 bits. For example, the number 20, which is 00010100 in binary, you would set it up as 0001 0100. Then, what you do, is you convert each nibble into decimal, for example, for the first nibble, 0001, since it equals one in decimal, you would then convert the decimal into hexadecimal, and since in hex 1 is 1, you would write 1. Now, for the second nibble, 0100, in decimal is 4, and in hex its 4, so 0001 1000 in hexadecimal is 0×18.

To convert from hexadecimal to binary, all you do is get the number. We then read from left to right, or right to left, it doesn’t matter, as long as we maintain the order. Do it from right to left. If the first digit is 0, and in binary 0 is 0000. Note that each digit in hexadecimal is 4 bits, so even though we can express 0 in 000000, and also 0, we have to fill up 4 bits, so it would be 0000.

Leave a Reply