Number bases explained
A number base (or radix) is how many different digits a system uses. Decimal uses ten (0–9). Binary uses two (0 and 1) and is how computers store everything. Hexadecimal uses sixteen (0–9 then A–F) and is a compact way to write binary, because each hex digit stands for exactly four bits. Octal uses eight digits, each standing for three bits.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 1 | 1 | 1 | 1 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
| 1024 | 10000000000 | 2000 | 400 |
Converting by hand
To convert decimal to another base, divide repeatedly by the base and read the remainders from last to first. To convert to decimal, multiply each digit by the base raised to its position and add the results: 1011₂ = 8 + 0 + 2 + 1 = 11.
