Other Bases — Octal, Hexadecimal and Any Base
On this page 10 headings
Start here Binary numbers get long very fast: 1011011011101110 is hard to read and easy to copy wrong. So engineers use a short form called hexadecimal, where every 4 bits become one symbol. That number is just 0xB6EE. You’ll see “0x…” all over this course: in control words, machine code and memory addresses.
In base b, each place is worth b times the place to its right, and the digits go from 0 to b − 1.
| Base | Name | Digits | Place values (right to left) |
|---|---|---|---|
| 2 | Binary | 0, 1 | 1, 2, 4, 8, 16 … |
| 8 | Octal | 0–7 | 1, 8, 64, 512 … |
| 10 | Decimal | 0–9 | 1, 10, 100 … |
| 16 | Hexadecimal (hex) | 0–9, A–F | 1, 16, 256, 4096 … |
In hex, the letters stand for: .
Rule: a digit can never be equal to or bigger than its base. “(143)₄” is impossible, because base 4 has no digit 4.
Since 16 = 2⁴, one hex digit = 4 bits. (Octal: one digit = 3 bits, since 8 = 2³.)
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
In one line: Every base works by place value (each place = base × the one to its right). Hex uses 0–9 and A–F, and each hex digit is exactly 4 bits. Exam words: base (radix), octal, hexadecimal, 0x prefix, A–F, nibble (4 bits), place value.
Steps: multiply each digit by its place value and add. Example: (431)₆ = 4×36 + 3×6 + 1×1 = 144 + 18 + 1 = 163
Steps: divide by the base again and again, and read the remainders from bottom to top (same as for binary, just a different divisor). Example: 163 → hex: 163 ÷ 16 = 10 remainder 3; 10 ÷ 16 = 0 remainder 10 (A) → 0xA3
Exam pattern: “A number in base 6 is 431. What is its hex form?” Go base 6 → decimal → hex: 431₆ = 163 = A3.
Steps (binary → hex): group the bits in 4s from the right (add 0s on the left if needed), then change each group to one hex digit. Example: 101111 → 0010 1111 → 2F Steps (hex → binary): write each hex digit as 4 bits. 0xDE → 1101 1110.
Trap: group from the right. Grouping from the left gives a wrong answer.
Example (real Quiz 1 pattern): if (143)ₐ = (212)ᵦ, find a and b.
Steps:
- Write both sides in decimal: .
- Try the answer options one by one, and pick the one where both sides
are equal:
- 63; 50 + 5 + 2 = 57, not equal ✗
- 80; 72 + 6 + 2 = 80 ✓
Answer: .
Tips:
- Don’t solve the equation by algebra in the exam. Testing the options is faster and safe.
- In true maths, each base must be bigger than its largest digit. But one past paper accepted an answer that breaks this rule (see “Try these” no. 3), so trust the equation over the digit rule.
“How many bits are needed to write the number 128 in binary?”
- 128 = 10000000₂ → 8 bits.
- Quick rule: the number N needs n bits where < 2ⁿ. For 128: 2⁷ = 128 ≤ 128 < 8.
Trap: this is different from “how many bits for 128 different values” (that’s 7 bits, values 0–127). Read the question carefully: a number vs a count of things.
