Programming: Converting Binary Numbers to Hexadecimal Numbers
Share
If you have a binary number and you need to convert that binary number to a hexadecimal number, all you need to do is separate the binary numbers into 4-bit numbers: 11000101 is an 8-bit 1100 0101 is the same number but separated into 2 4-bit numbers The 4-bit binary number can be represented like this: 8421 and where there is a '1', take those numbers and add then together: With 1100, there is a 1 in the 8 place and a 1 in the 4 place. Add those two together: 8+4 = 12. In hex, 12 is C since C is located at the 12th place: 0123456789AB(C)DEF For the second 4-bit binary number, there is a '1' at the 4 place and a 1 at the 1 place, so 4 + 1 = 5 and the Hex equvalent is just 5. So, 11000101 = C5 8421 8421 1100 0101 --------- 84-- -4-1 8+4 = 12 = C 4+1 = 5 = 5 C5