From NCERTAsked by Anonymous from Dallas, United States23 Oct 2026, 3:13 PM ISTUpdated
In one line
Some files compress more than others because they have more repeated or simple patterns that can be squeezed down.
The rule
Compression works by finding and shrinking repeated or predictable data in a file.
Let's understand it simply
Imagine you are packing clothes for a trip. If you have ten identical white shirts, you can say, "10 white shirts" instead of listing each one. This saves space in your bag. But if every shirt is different, you have to pack each one separately, and it takes more space.
Files work the same way. If a file has lots of repeated or simple data, like a plain blue image or a long text with many repeated words, the computer can use shortcuts to store it in less space. But if the file is full of random or unique data, like a photo with many colors or a song, there are fewer shortcuts, so it can't be squeezed much.
How much do different files compress?
File type
Compresses a lot?
Why
Plain text (.txt)
Yes
Many repeated words and spaces
Simple drawing (.bmp)
Yes
Large areas of same color
Photo (.jpg)
No
Already compressed, lots of details
Song (.mp3)
No
Already compressed, complex data
How it works
The computer looks for repeated patterns or simple data in the file.
It replaces these patterns with shorter codes or instructions.
The more patterns or repeats, the more space can be saved.
If the file is random or already compressed, there are fewer patterns to shrink.
The compressed file is saved. When you open it, the computer rebuilds the original file using the codes.
The story behind it
Compression was invented to save space and time. In the early days of computers, storage was expensive and slow. People like Abraham Lempel and Jacob Ziv (LZ77 and LZ78 algorithms) created clever ways to shrink files by spotting repeated data. Their work made it possible to send files faster and store more on small disks.
Where you see it in real life
ZIP files: You compress many documents into one ZIP file to email them. Text files shrink a lot, photos less.
Photos: A simple drawing in Paint (few colors) compresses more than a real camera photo (many details).
Music files: A recording of silence compresses more than a song with many instruments.
Videos: Cartoon videos (simple colors) compress more than live-action movies (lots of details).
PDFs: A PDF with just text compresses more than one with many pictures.
Why it matters
Saves space on your computer or phone, so you can store more files.
Makes it faster to send files over the internet, like on WhatsApp or email.
Used in apps, games, and websites to load things quickly.
Helps backup and store important data efficiently.
Common mistakes
Thinking all files compress the same amount. (They don't. Simple files shrink more.)
Trying to compress a file that is already compressed (like a JPEG photo or MP3 song). It won't get much smaller.
Believing compression always makes files tiny. Some files, like random data, barely shrink.
Remember it
If a file has lots of repeats or simple parts, it will compress more. If it's already mixed up or compressed, it won't shrink much.
Check yourself
Why does a plain text file compress more than a photo?
Because it has more repeated patterns and simple data.
What happens if you try to compress a file that is already compressed?
It will not shrink much because there are few patterns left to find.
Give one example of a file that compresses a lot and one that does not.
A text file compresses a lot; a JPEG photo does not.
Quick recap
Files with more repeated or simple data compress better.
Compression finds and shrinks patterns in files.
Photos and songs are often already compressed, so they shrink less.
Text and simple images usually compress a lot.
Compression saves space and makes sharing files faster.