Number bases & place value
One simple idea — place value — lets the same rule write a number in decimal, binary, octal, or hex. Master it once and every base is the same.
Built from first principles.
Before you start
What you need first
- Why digital — that a machine stores everything as bits (0/1), so we need a way to write numbers using only those symbols.
What you'll be able to do
- Read a number in any base using place value.
- Recognise binary, octal, hex and their digit sets.
- Use the key fact 1 hex digit = 4 bits, and the units bit / nibble / byte / word.
Start with what you know: decimal
You already use base-10 every day. Look at 2047 — each digit is worth the digit times a power of ten:
| Digit | 2 | 0 | 4 | 7 |
|---|---|---|---|---|
| Power | 10³ | 10² | 10¹ | 10⁰ |
| Place value | 1000 | 100 | 10 | 1 |
| Contributes | 2000 | 0 | 40 | 7 |
The same rule works in any base
In any base \(b\), a number's value is the sum of each digit times a power of \(b\):
The digits \(d_i\) are just symbols from \(0\) up to \(b-1\). Four bases matter to us:
| Base | Name | Symbols | Used for |
|---|---|---|---|
| 10 | Decimal | 0–9 | Everyday counting |
| 2 | Binary | 0 1 | Inside every digital circuit |
| 8 | Octal | 0–7 | Legacy (Unix permissions) |
| 16 | Hexadecimal | 0–9, A–F | Datasheets, addresses, colors |
When the base isn't obvious we mark it: 1011₂,
0b1011, 0x2F, 2F₁₆.
Binary — base 2
Two symbols, 0 and 1; each digit is a bit
(binary digit). Same place-value rule, powers of two:
Read 1011₂ in decimal
| Bit | 1 | 0 | 1 | 1 |
|---|---|---|---|---|
| Power | 2³ | 2² | 2¹ | 2⁰ |
| Place value | 8 | 4 | 2 | 1 |
| Contributes | 8 | · | 2 | 1 |
Why electronics uses binary — and the units
A transistor is either on or off, so two states are the easiest thing to build reliably. Two levels are also easy to tell apart under noise, and Boolean algebra (Theme 2) gives a clean math for combining them.
- bit — one binary digit (0 or 1)
- nibble — 4 bits (one hex digit's worth)
- byte — 8 bits (the smallest unit most systems address)
- word — a CPU's natural width (16 / 32 / 64 bits)
Counting 0–15 in three bases
This little table is the most useful thing in the topic — it appears in every binary/hex problem you will ever do.
| Dec | Binary | Hex | Dec | Binary | Hex |
|---|---|---|---|---|---|
| 0 | 0000 | 0 | 8 | 1000 | 8 |
| 1 | 0001 | 1 | 9 | 1001 | 9 |
| 2 | 0010 | 2 | 10 | 1010 | A |
| 3 | 0011 | 3 | 11 | 1011 | B |
| 4 | 0100 | 4 | 12 | 1100 | C |
| 5 | 0101 | 5 | 13 | 1101 | D |
| 6 | 0110 | 6 | 14 | 1110 | E |
| 7 | 0111 | 7 | 15 | 1111 | F |
Octal — base 8 (mostly historical)
Eight symbols, 0–7; each octal digit is exactly 3 bits.
You'll mainly meet it in Unix file permissions (chmod 755).
Hexadecimal — base 16 (the one you really need)
Sixteen symbols: the digits 0–9, then A–F for 10–15. Hex is the human-readable shorthand for binary. Compare:
| Binary | 1011 | 1110 | 1110 | 1111 |
| Hex | B | E | E | F |
So 1011111011101111₂ = 0xBEEF = 48879 — the hex form is half the length,
unambiguous, and groups bits the way hardware does (nibbles, bytes).
0x08000000), register values (0x55555555), I²C addresses
(0x68), colour codes (#1F4E79). If you memorise one number
system, make it hex.✏️ Try it yourself
(a) How many distinct values can 6 bits represent?
(b) Write decimal 19 in binary, using powers of 2.
(c) What is 0xA in decimal?
(d) How many hex digits does it take to write one byte?
10011₂.
(c) 0xA = 10.
(d) 2 hex digits (1 hex digit = 4 bits, 1 byte = 8 bits).
Recap — the whole topic on one screen
| Idea | What you own now |
|---|---|
| Place value | digit × base^position; the one rule behind every base |
| Binary | base 2, symbols 0/1, each digit a bit |
| Octal / Hex | base 8 (3 bits/digit, legacy) / base 16 (4 bits/digit, everywhere) |
| Key fact | 1 hex digit = 4 bits; 1 byte = 2 hex digits |
| Units | bit · nibble (4) · byte (8) · word (16/32/64) |