Characters, Images and Sound
The big idea
Computers store everything — text, images, sound — as binary numbers. This topic explains how each type of data is turned into 1s and 0s, and how to calculate file sizes.
Characters (text)
Each character (letter, digit, symbol) is given a unique binary code using a character set — an agreed table mapping characters to numbers.
ASCII
- ASCII uses 7 bits per character, giving 2⁷ = 128 characters (enough for English letters, digits, punctuation and control codes).
- Often stored in 8 bits (1 byte) with a spare bit.
- The codes are ordered:
A= 65,B= 66 … ;a= 97;0(the character zero) = 48. So the letter afterAis simplyA + 1.
Unicode
- ASCII can't cover the world's languages or emoji. Unicode uses more bits (16 or 32 per character) to represent tens of thousands of characters from every writing system.
- Unicode is backwards-compatible: the first 128 codes match ASCII.
- Trade-off: Unicode files take more storage than ASCII.
Text file size: number of characters × bits per character.
Example: 200 characters in ASCII (8 bits) = 200 × 8 = 1600 bits = 200 bytes.
Images (bitmaps)
A bitmap image is a grid of tiny squares called pixels. Each pixel's colour is stored as a binary number.
- Colour depth = the number of bits used per pixel. With n bits per pixel you can show 2ⁿ colours.
- 1 bit → 2 colours (black/white); 8 bits → 256 colours; 24 bits → ~16.7 million colours.
- Resolution = the number of pixels (e.g. width × height, or pixels per inch).
- More colour depth and higher resolution = better quality but larger files.
Image file size (in bits): width × height × colour depth.
Example: a 100 × 100 image at 3 bits per pixel = 100 × 100 × 3 = 30 000 bits = 3750 bytes ≈ 3.75 KB (plus a small header).
Images also store metadata — extra data about the file such as dimensions, colour depth, date taken and camera settings.
Sound
Sound is a continuous (analogue) wave. To store it digitally the computer takes samples — measurements of the wave's height at regular intervals. This is analogue-to-digital conversion.
- Sample rate = how many samples are taken per second, measured in hertz (Hz). Higher sample rate = more accurate copy of the wave.
- Sample resolution (bit depth) = the number of bits used per sample. Higher resolution = more precise amplitude values.
- Higher sample rate and resolution = better quality but larger files.
Sound file size (in bits): sample rate × sample resolution × seconds (× channels for stereo).
Example: 10 seconds at 44 100 Hz, 16 bits, 1 channel = 44 100 × 16 × 10 = 7 056 000 bits = 882 000 bytes ≈ 882 KB.
Worked example
An image is 200 pixels wide, 150 pixels tall, with a colour depth of 4 bits. Find its size in kilobytes.
1. Size in bits = 200 × 150 × 4 = 120 000 bits.
2. In bytes = 120 000 ÷ 8 = 15 000 bytes.
3. In KB = 15 000 ÷ 1000 = 15 KB.
Common mistakes
- Forgetting to divide by 8 to turn bits into bytes.
- Mixing up colour depth (bits per pixel) with resolution (number of pixels).
- Confusing sample rate (samples per second) with sample resolution (bits per sample).
- Forgetting that higher quality always means a larger file.
Exam tips
- Learn the three file-size formulas — they are common, high-mark calculation questions.
- Always state your units and convert clearly (bits → bytes → KB).
- If asked to compare quality, mention both the quality gain and the storage cost.
Key facts to remember
- Text: character set (ASCII = 7/8 bits, 128 chars; Unicode = 16/32 bits, huge range). Size = characters × bits per character.
- Image: colour depth (bits/pixel, 2ⁿ colours) and resolution. Size = width × height × colour depth.
- Sound: sample rate (Hz) and sample resolution (bits). Size = sample rate × resolution × seconds.