L
LLLOS.ai
Learn
L

Ask Your Tutor · Computer Science

Why do some files compress more than others?

From NCERT Asked by Anonymous from Dallas, United States 23 Oct 2026, 3:13 PM IST Updated

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 typeCompresses a lot?Why
Plain text (.txt)YesMany repeated words and spaces
Simple drawing (.bmp)YesLarge areas of same color
Photo (.jpg)NoAlready compressed, lots of details
Song (.mp3)NoAlready compressed, complex data

How it works

  1. The computer looks for repeated patterns or simple data in the file.
  2. It replaces these patterns with shorter codes or instructions.
  3. The more patterns or repeats, the more space can be saved.
  4. If the file is random or already compressed, there are fewer patterns to shrink.
  5. 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.
Written by the LLOS.ai tutor, checked against NCERT chapters. Asked by Anonymous from Dallas, United States on 23 Oct 2026, 3:13 PM IST