Binary, hexadecimal, images, sound & compression — understand how computers store and process data.
Key definitions, concepts, and terminology for Topic 2
Computers use binary because transistors (tiny electronic switches) can only be ON (1) or OFF (0) — just like a light switch. There is no “half on”. With 1 switch you get 2 states. With 2 switches, you get 4 combinations (00, 01, 10, 11). With 8 switches (1 byte), you get 256 combinations — enough to represent every letter, digit, and symbol you need.
| Number of Bits | Combinations (2n) |
|---|---|
| 1 bit | 2 values |
| 2 bits | 4 values |
| 3 bits | 8 values |
| 4 bits (nibble) | 16 values |
| 8 bits (byte) | 256 values |
Every piece of data inside a computer — text, images, sound, video, programs — is ultimately stored as patterns of 0s and 1s. The more bits you use, the more different values you can represent: 2n possible values for n bits.
Imagine trying to remember a phone number that’s 32 digits long — that’s what a binary colour code looks like! Hex condenses every 4 binary digits into a single character. So instead of writing 11111111 00000000 00000000 for pure red, you write FF0000.
Web developers use hex colour codes every day:
#FF0000 = Red
#00FF00 = Green
#0000FF = Blue
Each hex digit = exactly 4 binary digits (a nibble). Two hex digits = 1 byte. This is why hex is used for MAC addresses, colour codes, memory addresses, and error codes.
A digital image is like a mosaic made of tiny coloured tiles (pixels). Resolution = how many tiles there are (more tiles = more detail = bigger file). Colour depth = how many paint colours you have available:
| Colour Depth | Colours Available | Example |
|---|---|---|
| 1-bit | 2 | Black & white |
| 8-bit | 256 | GIF images |
| 24-bit | 16.7 million | True colour (photos) |
Walkthrough — Calculate the file size of a 1920×1080 image at 24-bit colour:
Step 1: Total pixels = 1920 × 1080 = 2,073,600 pixels Step 2: Total bits = 2,073,600 × 24 = 49,766,400 bits Step 3: Convert to bytes = 49,766,400 ÷ 8 = 6,220,800 bytes Step 4: Convert to KB = 6,220,800 ÷ 1024 = 6,075 KB Step 5: Convert to MB = 6,075 ÷ 1024 ≈ 5.93 MB
Increasing resolution OR colour depth increases file size. This is why compression is essential — a raw 4K photo would be over 24 MB!
Recording digital sound is like making a flipbook of a wave. The sample rate is how many “snapshots” you take per second (CD quality = 44,100 per second). The bit depth is how precisely you measure each snapshot (16-bit CD quality = 65,536 possible values). More snapshots + more precision = better quality but bigger file.
Walkthrough — Calculate file size for 3 minutes of CD-quality stereo audio:
Sample rate: 44,100 Hz Bit depth: 16 bits Channels: 2 (stereo) Duration: 3 min = 180 seconds Step 1: Total bits = 44,100 × 16 × 2 × 180 = 254,016,000 bits Step 2: Bytes = 254,016,000 ÷ 8 = 31,752,000 bytes Step 3: MB = 31,752,000 ÷ 1024 ÷ 1024 ≈ 30.3 MB
This is why MP3 compression exists — it reduces 30 MB to about 3–4 MB by removing frequencies humans can barely hear (lossy compression).
Lossless compression is like zipping a folder — when you unzip it, everything is exactly the same. Lossy is like photocopying a photocopy — each copy loses a tiny bit of detail, and you can never get the original back.
| Type | How It Works | Formats | Best For |
|---|---|---|---|
| Lossy | Permanently removes data humans won’t notice | JPEG, MP3, MPEG | Photos, music, video |
| Lossless | Finds patterns to store data more efficiently | ZIP, PNG, FLAC | Text, code, medical images |
Lossy gives smaller files but you lose quality permanently. Lossless gives larger files but the original data is perfectly preserved. Choose based on whether quality loss matters.
RLE works on data with lots of repeated consecutive values. It replaces runs of the same value with a count and the value.
Example: AAABBBCCCCDD becomes 3A3B4C2D. That’s 12 characters compressed to 8.
Encoding walkthrough:
Original: W W W W W B B B W W W W W W W W Count: 5 × W 3 × B 8 × W Encoded: 5W 3B 8W 16 characters → 6 characters (62.5% reduction!)
Decoding walkthrough:
Encoded: 4R 2G 5B Decoded: R R R R G G B B B B B Result: RRRRGGBBBBB
RLE is great for simple images with large blocks of the same colour (pixel art, diagrams, logos), but terrible for photographs where every pixel is different — it can actually make the file larger!
Units of data storage: 1 byte = 8 bits, 1 KB = 1024 bytes, 1 MB = 1024 KB, 1 GB = 1024 MB, 1 TB = 1024 GB.
Hexadecimal is used because it's more human-readable than binary. Each hex digit represents exactly 4 binary digits (a nibble).
Place values: 128, 64, 32, 16, 8, 4, 2, 1
Method: Write out the place values. Place the binary digits underneath. Add up the place values where there is a 1.
Example: 10110011
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
128 + 32 + 16 + 2 + 1 = 179
Method (Repeated Division by 2): Divide the denary number by 2 repeatedly. Record the remainder each time. Read the remainders from bottom to top.
Alternative (Place Value Method): Start from the left (128). If the place value fits into the remaining number, write 1 and subtract it. Otherwise write 0. Move to the next place value.
Example: Convert 179 to binary
179 ≥ 128? Yes → 1 (remaining: 51)
51 ≥ 64? No → 0
51 ≥ 32? Yes → 1 (remaining: 19)
19 ≥ 16? Yes → 1 (remaining: 3)
3 ≥ 8? No → 0
3 ≥ 4? No → 0
3 ≥ 2? Yes → 1 (remaining: 1)
1 ≥ 1? Yes → 1 (remaining: 0)
Result: 10110011
Hex to Binary: Split each hex digit into a 4-bit nibble.
Example: B3
B = 11 in denary = 1011 in binary
3 = 3 in denary = 0011 in binary
B3 = 10110011
Hex to Denary: Multiply each digit by its place value (16¹, 16&sup0;).
B3 = (11 × 16) + (3 × 1) = 176 + 3 = 179
Hex values: A=10, B=11, C=12, D=13, E=14, F=15. Each hex digit maps directly to one nibble (4 bits).
Rules:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (write 0, carry 1)
1 + 1 + 1 = 11 (write 1, carry 1)
Worked Example — Add 01101011 (107) + 00110101 (53):
Carry: 1 1 1 1 1
0 1 1 0 1 0 1 1 (107)
+ 0 0 1 1 0 1 0 1 ( 53)
——————————————————————
= 1 0 1 0 0 0 0 0 (160) ✔
Work from right to left. When 1+1 = 10, write 0 and carry 1 to the next column. When 1+1+1 = 11, write 1 and carry 1.
Overflow Example:
1 1 1 1 1 1 1 1 (255)
+ 0 0 0 0 0 0 0 1 ( 1)
——————————————————————
1 0 0 0 0 0 0 0 0 (256 — needs 9 bits!)
↑
This 9th bit is lost — the computer stores 00000000 (0) — WRONG!
Overflow occurs when the result of a binary addition exceeds the available number of bits (e.g., two 8-bit numbers produce a 9-bit result). The extra bit is lost, giving an incorrect answer. If adding two 8-bit numbers gives a 9th bit, the computer truncates it — the result wraps around and is wrong.
Formula: File size (bits) = width × height × colour depth
To convert to bytes, divide by 8. To convert to KB, divide by 1024. To convert to MB, divide by 1024 again.
Example: A 1920 × 1080 image with 24-bit colour depth:
1920 × 1080 × 24 = 49,766,400 bits
49,766,400 ÷ 8 = 6,220,800 bytes
6,220,800 ÷ 1024 = 6,075 KB
6,075 ÷ 1024 ≈ 5.93 MB
Increasing resolution or colour depth increases the file size. Higher colour depth = more colours available. Higher resolution = more detail but bigger file.
Formula: File size (bits) = sample rate × bit depth × duration (seconds)
To convert to bytes, divide by 8.
Example: A 30-second clip at 44,100 Hz sample rate with 16-bit depth:
44,100 × 16 × 30 = 21,168,000 bits
21,168,000 ÷ 8 = 2,646,000 bytes
2,646,000 ÷ 1024 ≈ 2,583.98 KB
2,583.98 ÷ 1024 ≈ 2.52 MB
Higher sample rate = more samples per second = better quality sound but larger file. Higher bit depth = more levels of amplitude = better quality but larger file.
Interactive converters and calculators for data representation
Type in any field to convert between number bases (8-bit: 0–255).
Add the two 8-bit binary numbers. Enter your answer below.
Enter the image dimensions and colour depth to calculate the file size.
Enter the recording properties to calculate the file size.
Apply your knowledge with hints available
Drag each item into the correct category.
Convert denary 179 to binary using the place value method. Fill in each bit. Click the hint button if you get stuck.
Drag the steps into the correct order for Run-Length Encoding.
Test your memory by matching terms with definitions
Find all 8 matching pairs. Click two cards to flip them.
Build answers using sentence banks, then reveal the mark scheme
No hints, no help — prove your mastery
See how you performed across each sub-topic
Complete activities to see your results