Number systems: octal and hexadecimal
SOF ICSO · Computer Science · about 5 minutes
Besides binary (base 2), computers use octal (base 8) and hexadecimal (base 16). Hex digits go 0–9 then A–F (10–15).
Each hex digit is exactly 4 bits, and each octal digit is 3 bits, so converting from binary is quick.
Place values
In base b, places are worth 1, b, b², b³… So (157)₈ = 1 × 64 + 5 × 8 + 7 = 111.
Shortcut through binary
To turn hex into octal, go hex → binary (4 bits per digit) → regroup in threes → octal.
Worked examples
Example 1Convert 255 to hex.
- 255 = 15 × 16 + 15.
Answer: FF
See it move
Where marks are lost
- Grouping bits from the left instead of the right.
- Writing 10 instead of A in hex.
Exam tips
- Group binary from the right in fours for hex, threes for octal.
- Colours on the web are hex: #FF0000 is red.
- (1A)₁₆ = 1 × 16 + 10 = 26.
Practice questions
(2F)₁₆ in decimal is…
Binary 110101 in octal is…
The largest single hex digit is…
More worked examples
Try each one first, then open the working.
Hex 96 in decimal?
Show the working
Start: Two hex digits: 16s and 1s.
First digit × 16 + second digit (A = 10 … F = 15).
Answer: 150
Binary 110010 in decimal?
Show the working
Start: Rightmost bit is 1s.
Add the place values 1, 2, 4, 8, 16, 32 where there is a 1.
Answer: 50
27 in binary? (type the digits)
Show the working
Start: Find the biggest power of 2 first.
Keep dividing by 2 and read the remainders upwards.
Answer: 11011
What is the hexadecimal number C32 in decimal?
Show the working
Start: Each place is worth 16 times the next.
C×16^2 + 3×16^1 + 2×16^0 = 3122.
Answer: 3122
Practise more
New questions every time, at exam level
Hex B0 in decimal?
Learn it properly
Full chapters with animations, each with an “Explained simply” version.