How computers store characters, images and sound, how compression shrinks files — and how to calculate file sizes the OCR way. Diagrams, worked examples, a file-size calculator and a timed 20-question quiz at the end.
The key terms from this lesson, grouped by topic.
n bits gives 2n colours.Every key you press is turned into a binary number the computer can store.
A character set is the collection of characters a computer can recognise, with a unique binary code for each one. The codes are in order, so once you know that A = 65 you can work out B = 66, C = 67 and so on.
ASCII codes
| Character | Denary | Binary (8-bit) |
|---|---|---|
| A | 65 | 01000001 |
| B | 66 | 01000010 |
| C | 67 | 01000011 |
| a | 97 | 01100001 |
| 0 | 48 | 00110000 |
| + | 43 | 00101011 |
| space | 32 | 00100000 |
How many characters can each set hold?
Bars not to scale — Unicode really is that much bigger.
| Set | Bits per character | Characters | Used for |
|---|---|---|---|
| ASCII | 7 | 27 = 128 | English letters, digits, punctuation, control codes |
| Extended ASCII | 8 | 28 = 256 | Adds accented letters (é, ñ) and extra symbols — useful for languages like French |
| Unicode | 16 or more (up to 32) | 65,536+ | Almost every language in the world, symbols and emoji — ideal for keyboards worldwide |
The trade-off: more bits per character means a bigger text file.
A bitmap image is a grid of tiny squares — each one has a binary colour code.
Bitmap images are made of pixels. In the simplest case, 1 = black and 0 = white. Here is an 8 × 8 image stored in just 1 bit per pixel — the binary code on the right is exactly what the computer stores:
1-bit image (64 pixels)
Colour depth is the number of bits for each pixel. More bits means more possible colours: number of colours = 2bits.
| Colour depth | Working | Colours |
|---|---|---|
| 1-bit | 21 | 2 |
| 2-bit | 22 | 4 |
| 4-bit | 24 | 16 |
| 8-bit | 28 | 256 |
| 16-bit | 216 | 65,536 |
| 24-bit | 224 | 16,777,216 |
Right-click any picture → Properties → Details to see its metadata (width, height, bit depth, resolution…).
Real sound is analogue. To store it, the computer measures it over and over — this is called sampling.
Low sample rate (few samples)
High sample rate (many samples)
sample rate × bit depth (× 2 for stereo).Increasing the sample rate or the bit depth makes the sound closer to the original recording — but the file gets bigger.
Making files smaller — for storage, loading times and sending attachments.
Compression has three big benefits: files take less storage space, they load and stream faster over the internet, and they can be sent as attachments quicker. There are two types:
| Lossy | Lossless | |
|---|---|---|
| How it works | Permanently removes data the user is unlikely to notice | Rewrites the data more efficiently (e.g. finding repeats) — no data is lost |
| Quality | Drops, depending on how much is compressed. The original cannot be restored | Identical to the original when decompressed |
| File size | Much smaller | Only a small reduction — still much bigger than lossy |
| Best for | Photos, music, video, websites | Text, program code, documents, anything that must be perfect |
| Examples | JPEG, MP3, MP4 | ZIP, PNG, FLAC |
Why lossy for songs on a phone? Smaller files mean more songs fit in limited storage, and they download or stream quicker using less data. Why lossless for text? Lose one character and the document or program is broken.
The three OCR formulas — always calculate in bits first, then convert.
bits ÷ 8 = bytes → bytes ÷ 1000 = KB → KB ÷ 1000 = MB
A document has 2,000 characters stored in 7-bit ASCII. How big is it?
An image is 800 pixels wide and 600 pixels high with a colour depth of 8 bits.
An image is 1920 × 1080 pixels with a 24-bit colour depth.
A 10-second recording uses a sample rate of 44,100 Hz and a bit depth of 16.
Exam tips: (1) Write the formula first. (2) Do the multiplying in bits — only divide by 8 at the end if the question asks for bytes. (3) Check the units asked for (bits, bytes, KB or MB). (4) If the question gives the sample rate in kHz, convert it: 44.1 kHz = 44,100 Hz.
Type in your own numbers and the calculator shows every step. Use it to check your working, not to skip it!
Multiple choice, true/false, fill in the blanks, drag-and-drop, matching, ordering and sorting — plus calculations. The timer starts when you press Start. Have a calculator and some paper ready!