Converting binary to hex is just the reverse:
-
Process the bits in groups of 4, starting from the right:
- Replace each group of 4 bits by the corresponding single hex digit
Example:
Write the binary string 10011110000111 in hex
(1) Separate 10011110001111 into groups of 4 (starting from the right):
10 0111 1000 1111
Add leadding 0's if necessary so the leftmost group also has 4 bits
0010 0111 1000 1111
(2) Replace each group of 4 bits by the corresponding hex 'digit'
and use 0x indicate this is a hex value:
Binary: 0010 0111 1000 1111
Hex 2 7 8 F
Answer: 0x278F