Math Fundamentals18 sections · 814 units
Open in Course

Binary to Hex Conversion

Grouping by fours

To convert binary to hex, group the bits into sets of 4 (starting from the right), then replace each group with its hex digit.

Example: Convert 11010110211010110_2 to hex. Group: 1101 0110. The group 1101 is D (13 in decimal). The group 0110 is 6. Result: D6. Reverse works too: D6 in hex becomes 11010110 in binary.

If the leftmost group has fewer than 4 bits, pad with zeros. For 101011021010110_2, pad to get 0101 0110, which is 56 in hex. This conversion is so fast that many programmers think in hex when debugging low-level code.