Number Systems Explained: Binary, Octal, Decimal and Hexadecimal Conversions
Number systems appear early in almost every computing degree, in maths, computer fundamentals and later in networking. They're also one of the most reliable topics to score full marks on, because every question follows a fixed method. This guide covers every conversion you'll need.
1. Place values: the one idea behind everything
In any base b, each digit is multiplied by a power of b depending on its position. In decimal, 345 = 3×102 + 4×101 + 5×100. Other bases work exactly the same way:
- Binary (base 2): digits 0–1, place values 1, 2, 4, 8, 16, 32 …
- Octal (base 8): digits 0–7, place values 1, 8, 64, 512 …
- Hexadecimal (base 16): digits 0–9 and A–F (A = 10 … F = 15), place values 1, 16, 256, 4096 …
2. Converting any base to decimal
Multiply each digit by its place value and add.
- Binary 1011012 = 32 + 0 + 8 + 4 + 0 + 1 = 4510
- Octal 2578 = 2×64 + 5×8 + 7 = 128 + 40 + 7 = 17510
- Hex 2F16 = 2×16 + 15 = 4710
3. Converting decimal to any base
Divide repeatedly by the target base and record the remainders. Read the remainders from bottom to top.
Example: 4510 to binary
| Division | Quotient | Remainder |
|---|---|---|
| 45 ÷ 2 | 22 | 1 |
| 22 ÷ 2 | 11 | 0 |
| 11 ÷ 2 | 5 | 1 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading upwards: 1011012, which matches the example in section 2.
Example: 17510 to hex: 175 ÷ 16 = 10 remainder 15 (F), then 10 ÷ 16 = 0 remainder 10 (A). Reading upwards: AF16.
4. Binary ↔ octal ↔ hex shortcuts
Because 8 = 23 and 16 = 24, you never need to go through decimal:
- Binary → octal: group bits in threes from the right. 101101 → 101 101 → 558.
- Binary → hex: group bits in fours from the right. 101101 → 0010 1101 → 2D16.
- Hex → binary: replace each hex digit with 4 bits. 3A → 0011 1010.
- Octal ↔ hex: go through binary. Octal 257 → 010 101 111 → 1010 1111 → AF16.
Check yourself: 1011012 = 45, 558 = 5×8 + 5 = 45 and 2D16 = 2×16 + 13 = 45. When all three agree, you're right.
5. Fractions
Digits after the point have negative powers: in binary they are worth ½, ¼, ⅛ and so on.
- Binary to decimal: 101.0112 = 5 + 0×½ + 1×¼ + 1×⅛ = 5 + 0.25 + 0.125 = 5.375
- Decimal to binary: multiply the fractional part by 2 repeatedly and take the whole-number part each time, reading top to bottom. 0.375 × 2 = 0.75 → 0; 0.75 × 2 = 1.5 → 1; 0.5 × 2 = 1.0 → 1. So 0.375 = 0.0112.
Some decimal fractions, like 0.1, never end in binary. If a question asks for a fixed number of places, stop there.
6. Exam tips
- Write the place values above the digits before converting; it prevents most mistakes.
- Always add the base subscript to your answer (1011012), as markers may expect it.
- Pad binary groups with leading zeros on the left only (and trailing zeros on the right after a point).
- Verify by converting your answer back. It takes thirty seconds and catches nearly every slip.