⚡
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!
Practice converting Denary to Binary! Flip the 8-bit switches above until your value hits the target number.
All three input boxes and the 8-bit switches above are completely synchronized. Type in denary, hex, or binary to watch them update simultaneously.
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!
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."
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.
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.
Output bit is 1 ONLY if BOTH Bit A and Bit B are 1. If either is 0, the output is 0.
val AND 00000001 checks if a number is odd (result 1) or even (result 0).
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).
| 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;) |
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!
Enough for 17.4 hours of continuous non-stop music playback! Over 250 typical MP3 pop songs in a playlist without repeating.
A single gigabyte holds a decent playlist or an hour of video streaming. Downloaded in about 15 seconds on superfast fibre broadband!
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!
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!
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!
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:
- 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!
- 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!).
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!
0, Go right = 1. Tracing from root to leaf gives the character's code.
| Char | Count | ASCII Bits | Huffman Code | Huffman Bits |
|---|
Explain why Huffman coding is classified as a lossless compression technique rather than a lossy compression technique.
View Model Answer • 2 Marks
• Mark 2: Decompressing the binary stream using the Huffman tree perfectly reconstructs the original uncompressed text bit-for-bit.
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 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!).
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 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.