Loading...
Login

Converting Between Binary, Octal, and Hexadecimal

You already know how to convert binary, octal, and hexadecimal numbers to and from decimal. But converting directly between binary, octal, and hex is even faster — and it doesn't need any decimal arithmetic at all. Instead, it uses a simple trick: grouping bits.

Because 8 = 2³ and 16 = 24, every octal digit corresponds to exactly 3 bits, and every hex digit corresponds to exactly 4 bits. That means you can convert by splitting the binary number into fixed-size chunks and translating each chunk on its own — no place-value multiplication needed.

Why Grouping Works

An octal digit can only be 0–7, which is exactly the range that 3 bits can represent (000 to 111). A hex digit can only be 0–15, which is exactly the range that 4 bits can represent (0000 to 1111). So instead of converting the whole number via decimal, you can convert each group independently and simply place the results side by side.

3 BitsOctal Digit
0000
0011
0102
0113
1004
1015
1106
1117
4 BitsHex Digit
00000
00011
00102
00113
01004
01015
01106
01117
10008
10019
1010A
1011B
1100C
1101D
1110E
1111F

Binary to Octal (Group in 3s)

Starting from the right, split the binary number into groups of 3 bits (pad the leftmost group with zeros if it's short), then convert each group to its octal digit using the table above.

101 010 111 (binary)
= 5  2  7
= 527 (octal)

See It Animated: Binary to Octal

Click through each group below, in order, to reveal its octal digit. A new random number is generated each time you load this page or press Reset.

Converting101010111 (binary)

101
=
?
010
=
?
111
=
?
Click Group 1 or Auto Play to begin!

Octal to Binary (Expand Each Digit to 3 Bits)

To convert the other way, expand each octal digit into its own 3-bit binary group, then join the groups together in the same order.

527 (octal)
= 101  010  111
= 101010111 (binary)

See It Animated: Octal to Binary

Click through each digit below, in order, to expand it into 3 bits. A new random number is generated each time you load this page or press Reset.

Converting527 (octal)

5
=
???
2
=
???
7
=
???
Click Digit 1 or Auto Play to begin!

Practice: Binary ↔ Octal

Convert the number below. If you get it wrong (or leave it blank), we'll walk through the grouping method with you.

Binary to Hex (Group in 4s)

The same idea applies to hex, but with groups of 4 bits instead of 3. Split the binary number into groups of 4 from the right (padding the leftmost group if needed), then convert each group to its hex digit.

1011 1110 1010 (binary)
= B  E  A
= BEA (hex)

See It Animated: Binary to Hex

Click through each group below, in order, to reveal its hex digit. A new random number is generated each time you load this page or press Reset.

Converting101111101010 (binary)

1011
=
?
1110
=
?
1010
=
?
Click Group 1 or Auto Play to begin!

Hex to Binary (Expand Each Digit to 4 Bits)

To convert the other way, expand each hex digit into its own 4-bit binary group (remember A–F stand for 10–15), then join the groups together in the same order.

BEA (hex)
= 1011  1110  1010
= 101111101010 (binary)

See It Animated: Hex to Binary

Click through each digit below, in order, to expand it into 4 bits. A new random number is generated each time you load this page or press Reset.

ConvertingBEA (hex)

B
=
????
E
=
????
A
=
????
Click Digit 1 or Auto Play to begin!

Practice: Binary ↔ Hex

Convert the number below. If you get it wrong (or leave it blank), we'll walk through the grouping method with you.

Octal to Hex, and Hex to Octal (Convert via Binary)

Octal groups bits in 3s and hex groups bits in 4s, so there's no clean way to line an octal digit up directly with a hex digit — 3 and 4 don't share the same grouping. The reliable shortcut is to use binary as a stepping stone:

  • Octal → Hex: expand each octal digit to 3 bits (as above), then regroup that same string of bits into 4s and read off the hex digits.
  • Hex → Octal: expand each hex digit to 4 bits, then regroup that string of bits into 3s and read off the octal digits.

When regrouping, always count from the right-hand end of the binary number, and pad the leftmost group with extra zeros if it's short.

143 (octal)
→ 001 100 011 (expand to 3-bit groups)
→ 001100011 (join)
→ 0 0110 0011 (regroup in 4s from the right)
→ 063 (hex)

And the reverse, using binary as the stepping stone the other way:

63 (hex)
→ 0110 0011 (expand to 4-bit groups)
→ 01100011 (join)
→ 001 100 011 (regroup in 3s from the right)
→ 143 (octal)

See It Animated: Octal to Hex (via Binary)

This one has two stages: first expand every octal digit into binary, then regroup those same bits into 4s to read off the hex digits. Click through each step below. A new random number is generated each time you load this page or press Reset.

Converting143 (octal)

Stage 1 — expand each octal digit to 3 bits
1
=
001
4
=
100
3
=
011
Stage 2 — regroup the 9 bits into 4s, counting from the right
0000
=
?
0110
=
?
0011
=
?
Click Step 1 or Auto Play to begin!
Key Points
  • Binary ↔ Octal: group/expand in 3s (since 2³ = 8).
  • Binary ↔ Hex: group/expand in 4s (since 24 = 16).
  • Always count groups from the right-hand end of the binary number, padding the leftmost group with zeros if needed.
  • Octal ↔ Hex has no direct shortcut — convert via binary first, then regroup.

Summary

Because octal and hex place values are powers of 2, converting to and from binary is just a matter of grouping bits — no decimal arithmetic required. Group binary in 3s for octal and in 4s for hex; expand octal or hex digits back into fixed-size binary groups to reverse the process; and use binary as the stepping stone whenever you need to go directly between octal and hex.

Related Topics

Home About Resources Dashboard