LearnWave
Learn it. Master it.

Encoding Schemes and Number System

Binary, octal and hexadecimal shortcuts

Convert binary to hex by grouping bits.

Binary, octal and hexadecimal are closely related, because 8 and 16 are powers of 2. Since 8 = 2³, one octal digit is exactly 3 bits; since 16 = 2⁴, one hexadecimal digit is exactly 4 bits. So conversions between them need no division at all, just grouping.

Binary to octal: starting from the right, split the bits into groups of 3, adding 0s on the left if the last group is short. Replace each group by its octal digit. (11010110)₂ = 011 010 110 = (326)₈.

Octal to binary: replace each octal digit by its 3 bits. (615)₈ = 110 001 101 = (110001101)₂.

Binary to hexadecimal: group into 4 bits from the right, adding 0s on the left if needed. (11010110)₂ = 1101 0110 = (D6)₁₆.

Hexadecimal to binary: replace each hexadecimal digit by its 4 bits (Table 2.6 in the book lists them). (4F2)₁₆ = 0100 1111 0010 = (010011110010)₂.

To go between octal and hexadecimal, use binary as a bridge: convert to binary first, then regroup.

3 bits per octal digit, 4 per hex digit.
3 bits per octal digit, 4 per hex digit.

Practise this lesson

Questions that get harder as you improve, a Tutor that helps without giving the answer away, and progress you can see. Free for every learner.

No account, no email address. Opens the real product.