Binary numbers and bits
Convert between binary and decimal and understand that everything in a computer is bits.
Prerequisites
Everyday explanation
A computer handles information using two symbols: 0 and 1. Such a symbol is called a bit. With bits, you can represent all numbers — you count in twos instead of tens.
| place | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|
| bit | 0 | 1 | 1 | 0 | 1 |
8 + 4 + 1 = 13. So 01101 corresponds to the number 13.
Eight bits are called a byte and are enough for 256 different values — for example, to store a letter or the intensity of a colour in a pixel.
Intuition
From decimal to binary: Find the largest power of two that fits, subtract it from the original number, and repeat the process.
21 → 16 fits (5 left) → 8 does not fit → 4 fits (1 left) → 2 does not fit → 1 fits.
21 = 10101.
Everything is bits. The letter A is stored as the number 65, which is 01000001 in binary. A pixel is described by three numbers (red, green, blue). An audio signal is stored as thousands of numbers per second. Even an AI model consists solely of bits — billions of them.
Mastery means
- Converts a number under 32 between binary and decimal
- Explains that text, images, and sound in a computer are bits
Sign in to do the exercises and build your mastery up.
Sources
- CS Unplugged (CC BY-SA 4.0) — CC BY-SA 4.0
- Swedish Wikipedia — Binary number system (CC BY-SA 4.0) — CC BY-SA 4.0