AQA GCSE Computer Science (8525), section 3.3.1 (Number bases)
Number bases
A number base is the number of different digits used to write numbers.
| Base | Name | Digits used |
|---|---|---|
| 10 | Decimal | 0 to 9 |
| 2 | Binary | 0 and 1 |
| 16 | Hexadecimal (hex) | 0 to 9 and A to F |
In hexadecimal, A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.
| Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
Why computers use binary
Computers are built from electronic switches that are either on or off. Two states can be represented by 1 and 0. So all data and instructions are stored and processed in binary.
A bit pattern (a group of 0s and 1s) can mean different things depending on how it is used. The same pattern could be an integer, a character of text, part of an image or part of a sound.
Why hexadecimal is used
Binary numbers are long and hard to read and easy to copy wrongly. Hexadecimal is a shorthand for binary: one hex digit stands for exactly four bits.
| Binary | Hex |
|---|---|
| 1111 1111 | FF |
| 1010 0011 | A3 |
Reasons to use hex:
- Shorter, so easier to read and write.
- Less likely to cause mistakes than long strings of 0s and 1s.
- Easy to convert to and from binary.
Hex is used for colour codes on web pages (such as #FF8800), memory addresses, and MAC addresses.
Common mistake: saying computers use binary "because it is simpler to understand". It is because the hardware uses two states (on and off). Also, hexadecimal is not a different way the computer stores data: it is a convenient way for people to write binary.
Exam tip: when asked why hexadecimal is used, say it is shorter and easier for people to read than binary, and that each hex digit matches four bits.
Check yourself
What are the digits used in hexadecimal?
0 to 9 and A to F.
Why do computers use binary?
The electronic components have two states, on and off, which are represented as 1 and 0.
Give one reason hexadecimal is used.
It is shorter and easier to read and write than binary, and easy to convert.