Back to Hub

Numbers & Characters

AQA 8525 §3.3.1 & §3.3.2
Base 2 (Binary) • Base 10 (Denary) • Base 16 (Hex)
⚡ Why Binary? (Plain English)

A computer processor contains billions of microscopic electronic switches called transistors. A switch can only be ON (1) or OFF (0). Because of this physical reality, all computer data—from games to streaming video—is stored as binary 1s and 0s!

Binary (Base 2): Uses only 0 and 1. Place values double: 128, 64, 32, 16, 8, 4, 2, 1.
Hexadecimal (Base 16): Uses 0-9 and A-F. Shorthand for humans because 1 hex digit = 4 bits (1 nibble).
Two's Complement: How computers store negative numbers. Flip the bits and add 1!
Number Mode:
High Nibble (Bits 7 - 4) Hex: 0
128
0
MSB
64
0
Bit 6
32
0
Bit 5
16
0
Bit 4
Low Nibble (Bits 3 - 0) Hex: 0
8
0
Bit 3
4
0
Bit 2
2
0
Bit 1
1
0
LSB
Denary Value (Base 10)
0
0 = 0
Hexadecimal (Base 16)
00₁₆
Hex shorthand (in code: 0x00)
Binary String (8-bit)
0000 0000
1 Byte (8 bits)
Interactive Practice

🎯 Binary Target Challenge

Practice converting Denary to Binary! Flip the 8-bit switches above until your value hits the target number.

🔥 Streak: 0
Target Number
Denary: 42
Your Register: 0 Needs +42
Live Converter

🔄 3-Way Number Converter

Type in any box to convert live!

All three input boxes and the 8-bit switches above are completely synchronized. Type in denary, hex, or binary to watch them update simultaneously.

Denary (Decimal) Base 10
Everyday human numbers (0 to 255)
Hexadecimal Base 16
Exam format: 2 hex digits (00 to FF)
Binary Base 2
Computer raw bits (1 Byte = 8 bits)
Why We Use Hex

🎨 Hex RGB Colour Playground

3 bytes = 16.7 Million colours

Ever wonder why hex codes like #FF5733 are used everywhere in web design, Discord, and games? Computer displays mix Red, Green, and Blue. Each colour channel gets 1 byte (0 to 255), which is written as exactly 2 hex digits!

🔴 Red Byte FF (255)
🟢 Green Byte 87 (135)
🔵 Blue Byte 33 (51)
#FF8733
Presets:
AQA 8525 §3.3.1 (Maths & Shifts)
📖 The 4 Golden Rules of Binary Addition
0 + 0 = 0
1 + 0 = 1
1 + 1 = 0 (carry 1)
1 + 1 + 1 = 1 (carry 1)
Interactive Tool

8-Bit Binary Adder

Click any cell in Row A or Row B to flip its bit
Place:
128
64
32
16
8
4
2
1
Denary
Carry:
0
0
0
0
0
0
0
-
Row A:
0
0
1
0
1
1
0
1
45
+ Row B:
0
0
0
1
0
1
1
0
22
Sum:
0
1
0
0
0
0
1
1
67
⚠️ Overflow Error Detected!
The sum of these two numbers exceeds 255 (11111111₂). The final addition in the MSB (128 column) created a carry bit that spilled over into a 9th bit. Because this register only holds 8 bits (1 byte), this 9th bit is lost, causing an incorrect result.
Key concept: "Overflow occurs when a calculation's result requires more bits than the CPU register has allocated to store it."
⚡ Hardware Trick: Subtraction is Free Addition ($A - B = A + (-B)$)

CPUs don't waste silicon on separate subtraction circuits. Instead, the ALU flips Number B into its negative Two's Complement, and simply adds it to A! Subtraction is literally free addition.

Subtraction Workbench

8-Bit Two's Complement Subtraction

Click cells in Row A or Row B to set numbers
Try Examples:
1️⃣ Step 1: Invert Number B (One's Comp) Flip all bits (0 ↔ 1)
11101100 Original B: 00010011 (19)
2️⃣ Step 2: Add 1 to get Two's Comp (-B) -B in 8 bits
11101101 Represents: -19
3️⃣ Step 3: Binary Addition [ A + (-B) ] 52 + (-19) = 33
Place:
128
64
32
16
8
4
2
1
Denary
Carry:
0
0
0
0
0
0
0
-
Row A:
0
0
1
1
0
1
0
0
52
+ (-B):
1
1
1
0
1
1
0
1
-19
Result:
0
0
1
0
0
0
0
1
33
📌 Final Carry Rule: In Two's Complement subtraction, when A ≥ B, an extra 9th carry bit spills out of the MSB. This final carry is ignored/discarded by the CPU! The 8 remaining bits give the correct answer.
💡 Bitwise Logic: Operating on Individual Bits

CPUs frequently manipulate raw bits rather than whole arithmetic numbers. This is called Bitwise Logic. In GCSE exams, the most important use case is Bit Masking: isolating, testing, clearing, or setting specific bits in a byte.

Bitwise Workbench

Bitwise Logic Lab

Choose an operator and click any bit to test
Place:
128
64
32
16
8
4
2
1
Denary
Row A:
1
1
0
1
0
1
1
0
214
AND Row B:
0
0
0
0
1
1
1
1
15
Result:
0
0
0
0
0
1
1
0
6
AND Operation (&)

Output bit is 1 ONLY if BOTH Bit A and Bit B are 1. If either is 0, the output is 0.

🎯 Exam Masking Use: Apply a mask of 0s to clear bits, or 1s to inspect specific bits. For example, val AND 00000001 checks if a number is odd (result 1) or even (result 0).
Shifts

Logical Binary Shifts

AQA §3.3.1: Multiplication & Division by Powers of 2

Moving bits to the left multiplies by 2 for each position shifted. Moving bits to the right divides by 2 (integer division, discarding the remainder).

Register Bits:
00010100
Denary:
20
Tip: Shifting left when the MSB is 1 drops the bit off the edge, causing data loss (overflow).
AQA 8525 §3.3.1.2 (Units of Data)
1 Bit (b) The smallest atomic unit of computer memory. Holds a single 0 or 1.
1 bit (b)
1 Nibble A group of 4 bits. Exactly represents 1 hexadecimal character (0 to F).
4 bits (1 hex digit)
1 Byte (B) A collection of 8 bits (2 nibbles). Stores 1 standard ASCII text character (e.g. 'A'). Remember: capital B = Byte, small b = bit!
8 bits (2 nibbles)
Official Syllabus

AQA Data Prefix Hierarchy: Byte to Petabyte

All values written out in full (no confusing shorthand)
Unit & Symbol Scale Name Decimal (SI) — All Zeros Written Out Binary (IEC) Prefix Binary (IEC) Value
Byte (B) Single Byte 1 Byte - 1 Byte
Kilobyte (kB) One Thousand 1,000 Bytes (10³) Kibibyte (KiB) 1,024 Bytes (2¹&sup0;)
Megabyte (MB) One Million 1,000,000 Bytes (10&sup6;) Mebibyte (MiB) 1,048,576 Bytes (2²&sup0;)
Gigabyte (GB) One Billion 1,000,000,000 Bytes (10&sup9;) Gibibyte (GiB) 1,073,741,824 Bytes (2³&sup0;)
Terabyte (TB) One Trillion 1,000,000,000,000 Bytes (10¹²) Tebibyte (TiB) 1,099,511,627,776 Bytes (2&sup4;&sup0;)
Petabyte (PB) One Quadrillion 1,000,000,000,000,000 Bytes (10¹&sup5;) Pebibyte (PiB) 1,125,899,906,842,624 Bytes (2&sup5;&sup0;)
💡 AQA Exam Guidance: In written exam calculation questions, AQA officially accepts calculations using 1,000 (decimal) OR 1,024 (binary) as full marks, as long as you show your workings!
Interactive Visualizer

🎵 Scale of Data: How Big Is It in Real Life?

Click or slide to explore from seconds to thousands of years

It can be hard to picture what "1 Petabyte" actually means. Standard high-quality MP3 audio (128 kbps stereo) plays at roughly 16 kB per second (about 1 MB per minute). Explore how much continuous music and real-world media fits into each level!

Byte Petabyte
1 Gigabyte (GB)
One Billion Bytes
9 Zeros (10⁹)
Exact Decimal Value in Bytes (All Zeros Written Out):
1,000,000,000 Bytes
Binary (IEC Gibibyte): 1,073,741,824 Bytes (2³⁰)
🎧 Continuous MP3 Music Time:
62,500 seconds ≈ 17.4 Hours!

Enough for 17.4 hours of continuous non-stop music playback! Over 250 typical MP3 pop songs in a playlist without repeating.

🌍 Real-World Media Equivalent:
~250 MP3 songs or 1 episode of Netflix in HD

A single gigabyte holds a decent playlist or an hour of video streaming. Downloaded in about 15 seconds on superfast fibre broadband!

Deep Dive & Real World

📦 Deep Dive: Why Do Both kB and KiB Exist? (The Hard Drive & Console Storage Mystery)

The secret behind "missing" gigabytes

Why does a 1,000 GB drive show as 931 GB on Windows or PlayStation?

1. Hardware Manufacturers sell in Decimal (SI): Hard drive and SSD makers count in standard everyday powers of 10. To them, 1 GB = 1,000,000,000 bytes (10&sup9;).

2. Operating Systems calculate in Binary (IEC): Because computer memory (RAM) is wired in powers of 2, Windows and consoles address storage using 1,024-byte multipliers: 1 GiB = 1,073,741,824 bytes (2³&sup0;).

The Result: When you plug in a 1,000 GB drive, Windows divides the 1,000,000,000,000 bytes by 1,073,741,824. The drive isn't faulty or secretly robbed of space — it's simply a difference between base-10 and base-2 math!

🎮 Live Hard Drive & Console Calculator:
GB
Presets:
1,000,000,000,000 bytes ÷ 1,073,741,824 bytes/GiB ≈ 931.32 GiB
Apparent "missing" space: 68.68 GB (≈ 7% difference) due purely to base-10 vs base-2 definition!
AQA 8525 §3.3.2 (Character Sets)
Live Decoder

Interactive Message Encoder

Try typing letters, numbers, or emojis (e.g. 'Hello 👾')
💾 Encoded Binary Stream Output: 9 Characters • 9 Bytes (72 bits)
01000111 01000011 01010011 01000101 00100000 00110010 00110000 00110010 00110110
Bytes separated by spaces for clarity. Hardware stores this as a continuous bitstream. Hex: 47 43 53 45 20 32 30 32 36
Character Breakdown:
ASCII Magic

🔤 The ASCII "+32" Case-Flipper (The Bit 5 Secret)

How computers flip case with a single bit

Ever wondered why 'A' is 65 and 'a' is 97? The difference is exactly 32 ($97 - 65 = 32$). In binary, 32 is a single bit power of two ($2^5$). To change any uppercase English letter to lowercase, a computer doesn't search a dictionary — it simply sets Bit 5 to 1!

UPPERCASE: 'A'
Denary: 65
Bit 5 = 0 (OFF)
lowercase: 'a'
Denary: 97 (65 + 32)
Bit 5 = 1 (ON → +32 added!)
Guaranteed Exam Question

📐 Letter Offset Exam Solver

"If 'A' is 65, what is the code for..."

GCSE exam boards regularly test whether you understand that character sets are strictly sequential. You don't need to memorize the whole ASCII table — only calculate the alphabetic distance!

'A' = 65 →
Storage Impact

💾 Storage Trade-Off: ASCII vs Unicode

Why we don't just use 32-bit for everything

Unicode solves the language barrier, but if every English letter took 4 bytes (UTF-32), file sizes would quadruple! See how your typed message compares across standards:

ASCII (American Standard Code)

7-bit / 8-bit
  • 7-bit ASCII: Represents $2^7 = 128$ characters (0 to 127). Covers English uppercase, lowercase, punctuation, and control codes.
  • Extended ASCII: Uses 8 bits ($2^8 = 256$ characters). Adds European accented characters like é, ñ, ü.
  • Limitation: Cannot represent Chinese, Arabic, Hindi, Cyrillic, or emojis!

Unicode (Universal Encoding)

16-bit to 32-bit
  • Universal: Designed to represent every writing system in the world plus thousands of mathematical symbols and emojis.
  • Variable Length (UTF-8): Uses 1 to 4 bytes per character.
  • Backwards Compatible: The first 128 Unicode characters are identical to standard ASCII (e.g. 'A' is code 65 in both!).
AQA 8525 §3.3.5 • OCR J277 §2.1 • Lossless Compression
⚡ Why Huffman Coding? (Plain English)

Standard ASCII allocates a fixed 8 bits (1 byte) for every character, whether it's common like 'E' or rare like 'Z'. Huffman coding is a brilliant lossless algorithm that analyses character frequencies and builds a binary tree. The most frequent characters sit near the top of the tree and receive short binary codes (1–2 bits), saving up to 70% of storage!

Frequency First: Count how often each character appears. Rare letters get combined first into branches.
Branch Convention: Go left = 0, Go right = 1. Tracing from root to leaf gives the character's code.
Prefix Rule (Crucial!): No code is a prefix of any other code. This means a continuous binary stream can be uniquely decoded without any spaces!

1. Input Text & Presets

8 Characters
1-Click Exam Presets:
Visualizer

2. Binary Huffman Tree

Left = 0 • Right = 1
Character Frequencies (Least to Most):
Hover over any leaf node or table row to trace its branch path from the root!
Codebook

3. Generated Codebook & Stats

Saved 68%
Char Count ASCII Bits Huffman Code Huffman Bits
GCSE Storage Formula: 20 bits vs 64 bits
STANDARD ASCII: 8 chars × 8 = 64 bits
HUFFMAN COMPRESSED: Total = 20 bits
Encoded Binary Bitstream:
Exam Practice

GCSE Exam Questions on Huffman Coding

Guaranteed Exam Topic
Question 1 • 2 Marks

Explain why Huffman coding is classified as a lossless compression technique rather than a lossy compression technique.

View Model Answer • 2 Marks
• Mark 1: No original character data is permanently discarded or lost during compression.
• Mark 2: Decompressing the binary stream using the Huffman tree perfectly reconstructs the original uncompressed text bit-for-bit.
Question 2 • 3 Marks

The word "BANANA" is compressed using Huffman coding into codes: A = 0, N = 10, B = 11. Calculate the total bits saved compared to standard 8-bit ASCII.

View Model Answer • 3 Marks
• Mark 1 (ASCII): 6 letters × 8 bits = 48 bits.
• Mark 2 (Huffman): B(2) + A(1) + N(2) + A(1) + N(2) + A(1) = 2 + 1 + 2 + 1 + 2 + 1 = 9 bits.
• Mark 3 (Saved): 48 - 9 = 39 bits saved (81.25% reduction!).
Question 3 • 2 Marks (Exam Trap)

Why must the Huffman tree or frequency table be saved inside the compressed file header along with the binary stream?

View Model Answer • 2 Marks
• Mark 1: Huffman codes are dynamic and unique to every individual document based on its letter frequencies.
• Mark 2: Without the frequency table / tree dictionary in the header, the receiving computer has no translation key to decode which bits belong to which characters.