Intuition What this page is for
The parent note taught you the rules of converting between binary, octal, hex, and decimal. This page hunts down every awkward corner those rules can land you in — the padding cases, the "wait, is that a zero?" cases, the huge-number case, the exam trick — and works each one out slowly. By the end you should never meet a conversion that surprises you.
If any word below feels unfamiliar, it was built in the parent: the parent topic . We lean on Positional number systems and place value and Binary number system throughout.
Before solving anything, let's list every kind of conversion problem this topic can hand you. Think of it as a checklist — each worked example below is stamped with the cell it fills.
#
Case class
What makes it tricky
Example that covers it
A
Binary → hex, length is a multiple of 4
clean chop, no padding
Ex 1
B
Binary → hex/oct, length not a multiple of the group size
must pad the left with zeros
Ex 2
C
Hex/octal → binary → decimal
expand digits, watch letter digits A–F
Ex 3
D
Decimal → base by repeated division
remainders read bottom-up
Ex 4
E
Hex ↔ octal (different group sizes)
must route through binary
Ex 5
F
Degenerate / zero-ish inputs
value 0, a lone digit, leading zeros
Ex 6
G
Limiting / boundary value
the largest value a byte can hold
Ex 7
H
Real-world word problem
translate a story into a conversion
Ex 8
I
Exam-style twist
"10 in base b", or a mixed-up base claim to debunk
Ex 9
We'll walk them in order. Grab the group-size fact once and reuse it everywhere:
The figure above is your ruler for every example: the same 8-bit byte sliced two ways — into 4-bit slices (hex) and 3-bit slices (octal). Notice the octal slicing spills past the left edge , forcing a pad. That spill is the source of half the mistakes on this page.
1011100 0 2 → hex
Forecast: the bit-string is 8 long, and 8 = 4 + 4 . Guess: exactly 2 hex digits, no padding needed. What are they?
Group into 4s from the right.
left 1011 right 1000
Why this step? Place values start at 2 0 on the right (see the ruler figure), so groups must be counted from the right or the 1 6 i blocks won't line up.
Name each group. Left 101 1 2 = 8 + 0 + 2 + 1 = 11 = B . Right 100 0 2 = 8 = 8 .
Why this step? Each 4-bit block is one hex digit by the grouping rule; B is the letter-digit for 11 .
⇒ B 8 16
Verify: expand back. B 8 16 = 11 ⋅ 16 + 8 = 176 + 8 = 184 . And 1011100 0 2 = 128 + 32 + 16 + 8 = 184 . ✓ Same number, two spellings.
110110 1 2 → hex and octal
Forecast: this string is 7 bits long. 7 is not a multiple of 4 (hex) nor of 3 (octal). Guess: both conversions need left-padding. How many zeros each?
Hex — group into 4s from the right.
only 3 bits! 110 1101
The leftmost group is short, so pad it on the left to 4 bits: 110 → 0110 .
6 0110 D 1101 ⇒ 6 D 16
Why this step? Padding the left adds high-order zeros, which have value 0 — the number is unchanged, but now every group is a full hex digit.
Octal — group into 3s from the right.
1 bit! 1 101 101
Pad the leftmost group: 1 → 001 .
1 001 5 101 5 101 ⇒ 15 5 8
Why this step? Same logic — high-order zeros are free; a 3-bit boundary must be respected.
Verify: 6 D 16 = 6 ⋅ 16 + 13 = 96 + 13 = 109 . 15 5 8 = 1 ⋅ 64 + 5 ⋅ 8 + 5 = 64 + 40 + 5 = 109 . And 110110 1 2 = 64 + 32 + 8 + 4 + 1 = 109 . ✓ All three agree.
Common mistake Padding on the wrong side
Padding on the right (writing 1101101 0 ) multiplies the value by 2 — you've changed the number! Only leading (left) zeros are free. This is the single most common conversion bug.
3AC 16 → decimal
Forecast: three hex digits, so place values 1 6 2 , 1 6 1 , 1 6 0 . The middle digit is a letter — A = 10 , C = 12 . Guess: a few hundred, since 3 ⋅ 256 ≈ 768 .
Write the positional sum.
3 AC 16 = 3 ⋅ 1 6 2 + A ⋅ 1 6 1 + C ⋅ 1 6 0
Why this step? This is the definition of base 16 from Positional number systems and place value : each digit times its place value 1 6 i .
Substitute the letter values. A = 10 , C = 12 .
= 3 ⋅ 256 + 10 ⋅ 16 + 12 ⋅ 1
Why this step? A –F are fixed digits, not variables — A always means 10 .
Add.
= 768 + 160 + 12 = 94 0 10
Verify: cross-check via binary. 3 = 0011 , A = 1010 , C = 1100 ⇒ 0011 1010 110 0 2 . That is 512 + 256 + 128 + 32 + 8 + 4 = 940 . ✓
94 0 10 → octal
Forecast: we just saw 940 = 3AC 16 . Now go to octal. Guess: 4 octal digits, since 8 3 = 512 ≤ 940 < 4096 = 8 4 .
Divide by 8, keep quotient and remainder, repeat.
940 ÷ 8 = 117 r 4
117 ÷ 8 = 14 r 5
14 ÷ 8 = 1 r 6
1 ÷ 8 = 0 r 1
Why this step? Dividing by the base peels off the lowest digit as the remainder (every higher term d i ⋅ 8 i with i ≥ 1 is divisible by 8, so only d 0 survives). The quotient is the number "shifted right" one octal digit.
Read remainders bottom → top: 1 , 6 , 5 , 4 .
⇒ 165 4 8
Why bottom → top? The first remainder is the lowest place value 8 0 , so it goes on the far right.
Verify: 165 4 8 = 1 ⋅ 512 + 6 ⋅ 64 + 5 ⋅ 8 + 4 = 512 + 384 + 40 + 4 = 940 . ✓
The figure shows the division ladder: read the remainder column upward to build the answer.
3AC 16 → octal, without going via decimal
Forecast: hex uses 4-bit chunks, octal uses 3-bit chunks — they don't line up. Guess: expand to binary, then re-slice into 3s. Should land on 165 4 8 again (matching Ex 4).
Expand each hex digit to 4 bits.
3 → 0011 , A → 1010 , C → 1100
⇒ 0011 1010 110 0 2
Why this step? Each hex digit is exactly 4 bits — no arithmetic, just look-up.
Forget the old slice lines. Re-group into 3s from the right.
001 110 101 100
(Twelve bits, 12 = 4 × 3 , so it divides evenly — no extra padding.)
Why this step? The bits carry the value; the slice size (4 vs 3) is just how we read them. Both readings describe the same binary, which is why binary is the universal middle-man.
Name each 3-bit group. 001 = 1 , 110 = 6 , 101 = 5 , 100 = 4 .
⇒ 165 4 8
Verify: matches Ex 4's answer 165 4 8 exactly. ✓ (And we never touched decimal.)
Common mistake Trying to map hex digits straight to octal digits
There is no fixed "hex digit → octal digit" table, because g cd -of-group-sizes is 1: a 4-bit boundary and a 3-bit boundary only re-align every 12 bits. Always drop to binary first.
Worked example Ex 6 — the tricky little ones
Forecast: each of these looks "too small to have rules." Guess whether the rules still hold.
(a) Convert 0 10 to hex. Repeated division: 0 ÷ 16 = 0 r 0 . One remainder: 0 . So 0 10 = 0 16 .
Why? Zero has value 0 in every base — the sum ∑ d i b i is empty/zero.
(b) Convert 0000 010 1 2 to hex. Group in 4s: 0000 0101 → 0 , 5 ⇒ 0 5 16 , which is just 5 16 .
Why? Leading zeros are free; they neither add value nor change the low digit.
(c) Convert 7 16 (a single hex digit) to binary. 7 = 011 1 2 . A one-digit number still expands to its 4-bit pattern.
Why? One hex digit is defined as 4 bits — write the leading zero to keep the block full when it matters, drop it when it doesn't.
(d) Convert 8 10 to binary. 8 = 100 0 2 . Here "10 -looking" traps don't apply — this is genuine decimal eight.
Verify: (a) 0 = 0 ✓. (b) 0 5 16 = 5 and 0000010 1 2 = 5 ✓. (c) 7 16 = 7 and 011 1 2 = 4 + 2 + 1 = 7 ✓. (d) 100 0 2 = 8 ✓.
Worked example Ex 7 — the largest 8-bit number
Forecast: eight bits, all set to 1: 1111111 1 2 . This is the maximum value one byte can store. Guess its hex and decimal forms — a memorable pair.
Hex: group in 4s. 1111 1111 → F , F ⇒ F F 16 .
Why this step? 111 1 2 = 8 + 4 + 2 + 1 = 15 = F , twice.
Decimal: F F 16 = 15 ⋅ 16 + 15 = 255 . Equivalently, the byte counts 0 through 255 , which is 256 = 2 8 distinct values.
Why this step? All-ones of length n equals 2 n − 1 ; here 2 8 − 1 = 255 .
Octal: re-slice 11111111 (8 bits) into 3s from the right: 11 111 111 → 011 111 111 = 3 , 7 , 7 ⇒ 37 7 8 (pad the top group).
F F 16 = 25 5 10 = 37 7 8
Verify: 255 = 2 8 − 1 ; 37 7 8 = 3 ⋅ 64 + 7 ⋅ 8 + 7 = 192 + 56 + 7 = 255 . ✓ This is why memory sizes love hex: one byte = two hex digits, max FF.
Worked example Ex 8 — reading a colour code
Statement: A web colour is written #D35400 (this page's burnt-orange accent!). The last two hex digits 00 are the blue channel, the middle two 54 are green , and the first two D3 are red . Each channel is one byte (0–255). What is the red channel's decimal value, and is it more or less than half of maximum?
Forecast: D3 — high digit is D = 13 , so this is a large-ish byte. Guess: over 200.
Isolate the red byte: D3 16 .
Why this step? Each colour channel is exactly one byte = two hex digits; D3 are the first two.
Expand. D = 13 , so D3 16 = 13 ⋅ 16 + 3 = 208 + 3 = 21 1 10 .
Why this step? Positional expansion of a 2-digit hex number.
Compare to half of max. Max is 255 ; half is 127.5 . Since 211 > 127.5 , red is more than half-on — hence the warm, strong orange.
Verify: 211 in binary is 1101001 1 2 = 128 + 64 + 16 + 2 + 1 = 211 . ✓ And 211 < 255 , a valid byte.
10 in every base" and a claim to debunk
Statement (part 1): A quiz claims "10 always means ten." Evaluate 1 0 2 , 1 0 8 , 1 0 16 .
Forecast: each should equal its own base, not ten.
Expand each using the definition d 1 b 1 + d 0 b 0 with d 1 = 1 , d 0 = 0 .
1 0 2 = 1 ⋅ 2 + 0 = 2 , 1 0 8 = 1 ⋅ 8 + 0 = 8 , 1 0 16 = 1 ⋅ 16 + 0 = 16
Why this step? "10 " is always one unit of the base plus zero units — i.e. the base itself. The claim is false except in base 10.
Statement (part 2): A student writes "2F 16 = 2 F 8 because both are just grouped binary." Debunk it.
Test the octal claim. In octal, digits only go 0 –7 ; there is no digit F . So "2 F 8 " isn't even a legal octal number.
Why this step? A digit must satisfy 0 ≤ d i < b . With b = 8 , F (=15) is out of range.
Do it properly (via binary). 2F 16 = 0010 111 1 2 ; re-slice in 3s: 00 101 111 → 000 101 111 = 0 , 5 , 7 ⇒ 5 7 8 .
Verify: 2F 16 = 2 ⋅ 16 + 15 = 47 ; 5 7 8 = 5 ⋅ 8 + 7 = 47 . ✓ Equal values , different spellings — never equal digit-strings.
Recall Quick self-test — cover the answers
Which side do you pad when a bit-string is too short for its group? ::: The left (high-order zeros are free; right-padding doubles the value).
94 0 10 in octal? ::: 165 4 8 .
Why can't you convert hex→octal by swapping digits directly? ::: 4-bit and 3-bit boundaries only re-align every 12 bits; route through binary.
Largest 8-bit value in hex / decimal / octal? ::: FF 16 = 25 5 10 = 37 7 8 .
Is 2 F 8 a valid number? ::: No — octal digits are 0 –7 , and F = 15 is out of range.
Mnemonic The three-word survival kit
"Right, pad, binary." Group from the right , pad the leftmost group with zeros, and when hex meets octal, drop to binary first.