A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

File Compression and Archives

Middle & High School Depth 53 in the knowledge graph ☐ I know this ☆ Set as goal
5topics build on this
234prerequisites beneath it
See this on the map →
File System BasicsIntroduction to Exponents→→File Management and Organization
compression zip archives files

Core Idea

File compression reduces the size of files or groups of files by encoding their data more efficiently, making them faster to transfer and easier to store. Archive formats like ZIP bundle multiple files and folders into a single package, which is especially useful for email attachments and downloads. Compression works better on some file types than others — text and documents compress dramatically, while photos and videos (already compressed) shrink very little. Password-protecting an archive adds a layer of security for sensitive files in transit.

How It's Best Learned

Create a ZIP archive from a folder of mixed files (documents, images, a video) and compare the original folder size to the ZIP size. Extract the archive to a different location and verify the files are identical. Then create a password-protected archive and try opening it without the password.

Common Misconceptions

Explainer

You already know from your file system experience that files have sizes — a text document might be 50 KB, a photo 3 MB, a video 1 GB. File compression exploits the fact that most files contain redundant or predictable patterns, and that redundancy can be encoded more efficiently than storing every byte separately. The result is a smaller file containing exactly the same information, which can be restored to its original form without any loss.

The intuition behind lossless compression (the kind used in ZIP files) is substitution. Instead of storing the same sequence of bytes repeatedly, store a compact rule. A text document containing the word "the" five hundred times could instead store a short code for "the" plus a lookup table — taking up far less space. Run-length encoding does something similar: instead of writing ten identical bytes in a row, write "10 × [value]." These substitutions accumulate dramatically for text, spreadsheets, and program code, which have lots of repetitive structure. A plain text document often compresses to 10–30% of its original size.

However, files that are already compressed gain almost nothing from a second compression pass — and sometimes grow slightly. JPEG photos, MP3 audio, and MP4 videos have already had their redundancy removed by specialized compressors designed specifically for each format. When you add them to a ZIP file, the ZIP algorithm finds almost no patterns to exploit and adds its own small overhead on top. This is the most important practical fact about compression: it only helps when unexploited redundancy remains. Your exponent intuition applies here — compression ratios multiply, so compressing already-compressed data gives you a ratio near 1×, meaning almost no reduction.

Archive formats like ZIP, TAR, and 7z serve a second purpose beyond compression: bundling. They package an entire folder hierarchy — multiple files and subfolders at any nesting depth — into a single file, which is far easier to transfer or attach to an email than a loose collection. ZIP does both operations simultaneously (bundle and compress). TAR bundles without compressing; a separate compression step (gzip or bzip2) then compresses the bundle, producing filenames like `.tar.gz` — "bundled, then compressed." Password-protecting an archive encrypts its contents so they cannot be read without the correct key, adding privacy for sensitive files in transit. Together, compression and archiving are two distinct operations that often happen to travel together in common formats.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Making 10 as an Addition Strategy → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts Through 10 → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Opposites and Additive Inverses → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → File Compression and Archives

Longest path: 54 steps · 234 total prerequisite topics

Prerequisites (2)

Leads To (1)