Lossy vs Lossless Compression: What Actually Changes in the File?
Learn the difference between lossy and lossless compression, how each method works, what data is removed, and when to use one over the other.
Almost everyone has encountered the terms lossy compression and lossless compression.
You might see them when:
- Exporting images
- Compressing PDFs
- Encoding audio
- Optimising videos
- Saving design files
The names suggest a simple difference.
Lossless means nothing is lost.
Lossy means something is lost.
While technically correct, that explanation doesn’t really answer the question most people are asking:
What actually changes inside the file?
Understanding that distinction helps explain why some files can shrink dramatically while others only become slightly smaller.
Why Compression Exists
Digital files contain data.
Lots of it.
A single image might contain millions of pixels.
A video might contain billions.
An audio recording may contain tens of thousands of samples every second.
Without compression, file sizes would quickly become impractical.
Compression attempts to reduce file size while preserving as much useful information as possible.
Different compression methods achieve this in different ways.
This is where lossy and lossless compression diverge.
What Is Lossless Compression?
Lossless compression reduces file size without permanently removing information.
After decompression, the original file can be reconstructed exactly.
Every bit of data remains intact.
Original File
↓
Lossless Compression
↓
Compressed File
↓
Decompression
↓
Original File
The final result is identical to the starting file.
Nothing is discarded.
How Lossless Compression Works
Lossless compression looks for redundancy.
Suppose a file contains:
AAAAAAAAAA
Instead of storing:
AAAAAAAAAA
the compression algorithm may store:
10 × A
The same information requires less space.
When decompressed, the original data is restored perfectly.
Real compression algorithms are far more sophisticated, but the principle remains similar.
They identify patterns, repetition, and predictable structures that can be represented more efficiently.
Common Lossless Formats
Lossless compression is used in many popular formats.
Images
- PNG
- GIF
- TIFF (optional)
- RAW formats
Audio
- FLAC
- ALAC
- WAV (typically uncompressed)
Archives
- ZIP
- 7Z
- GZIP
- RAR
Documents
- Many PDF files
- Office document formats such as DOCX and XLSX
These formats preserve the original data.
What Is Lossy Compression?
Lossy compression reduces file size by permanently removing information.
The algorithm decides which data is less important and discards it.
Original File
↓
Lossy Compression
↓
Smaller File
Once removed, that information cannot be recovered.
Even if the file is decompressed later, the original file no longer exists.
Why Lossy Compression Exists
If lossless compression preserves everything, why use lossy compression at all?
Because some files contain enormous amounts of information.
Lossless compression can only remove redundancy.
Lossy compression can remove actual content.
This allows much larger size reductions.
Consider:
- A 20 MB image becoming 3 MB
- A 100 MB audio file becoming 8 MB
- A 1 GB video becoming 100 MB
These reductions would often be impossible using lossless methods alone.
How Lossy Compression Works
Lossy compression relies on a key observation.
Humans do not perceive all information equally.
Some details contribute significantly to perception.
Others contribute very little.
Compression algorithms attempt to remove information that people are less likely to notice.
The exact approach depends on the file type.
Lossy Image Compression
Image formats such as JPEG analyse visual information.
The algorithm may:
- Remove subtle colour variations
- Simplify fine detail
- Reduce high-frequency information
- Approximate neighbouring pixels
The image still looks similar.
The underlying pixel data changes.
This is why repeatedly saving a JPEG often causes visible quality degradation.
Each save removes additional information.
Lossy Audio Compression
Formats such as MP3 and AAC use psychoacoustic models.
They attempt to remove sounds that are less noticeable to human hearing.
Examples include:
- Frequencies outside typical hearing ranges
- Sounds masked by louder frequencies
- Very subtle audio details
The listener often perceives little difference while file size decreases dramatically.
Lossy Video Compression
Video compression combines multiple techniques.
Algorithms may:
- Remove visual detail
- Simplify colour information
- Predict motion between frames
- Store only differences between frames
Modern video formats such as H.264 and H.265 depend heavily on lossy compression.
Without it, streaming services would be impractical.
What Actually Changes in the File?
This is the most important distinction.
Lossless Compression
The data remains identical.
Original Data
=
Recovered Data
Every bit can be restored.
Lossy Compression
The data changes.
Original Data
≠
Recovered Data
The file may appear similar, but portions of the original information no longer exist.
The degree of change depends on compression settings.
Lossy vs Lossless Compression
| Feature | Lossless | Lossy |
|---|---|---|
| Original Data Preserved | Yes | No |
| Quality Reduction | None | Possible |
| File Size Reduction | Moderate | Significant |
| Reversible | Yes | No |
| Repeated Saves Safe | Yes | No |
| Suitable for Editing | Excellent | Limited |
| Suitable for Distribution | Sometimes | Often |
Neither approach is universally better.
The right choice depends on the use case.
Why PNG Files Are Larger Than JPEG Files
This comparison illustrates the difference perfectly.
PNG uses lossless compression.
JPEG uses lossy compression.
Imagine a photograph containing:
- Millions of colours
- Fine gradients
- Complex textures
PNG must preserve every pixel exactly.
JPEG can simplify some of that information.
The result:
PNG = Larger File
JPEG = Smaller File
This is why photographs are usually saved as JPEG while logos and screenshots are often saved as PNG.
Why PDFs Sometimes Shrink Dramatically
PDF compression depends on the content inside the document.
A PDF containing:
- Text
- Vector graphics
may already be relatively efficient.
A PDF containing:
- High-resolution images
- Scanned pages
often benefits significantly from lossy image compression.
Many PDF compression tools reduce size by recompressing embedded images rather than modifying the document structure itself.
Why Repeated JPEG Saves Reduce Quality
A common misconception is that saving a JPEG simply preserves the existing file.
What actually happens is:
JPEG
↓
Decompress
↓
Recompress
Each recompression step removes additional information.
Over time, visible artifacts begin to appear.
These may include:
- Blurring
- Blockiness
- Colour degradation
- Loss of fine detail
Lossless formats do not suffer from this problem.
When Should You Use Lossless Compression?
Lossless compression is usually the best choice when:
- Editing files repeatedly
- Preserving original quality
- Storing source material
- Archiving important data
- Working with graphics containing text
Examples include:
- Design assets
- Source photographs
- Software files
- Legal documents
- Database backups
When Should You Use Lossy Compression?
Lossy compression is often appropriate when:
- Minimising file size matters
- Small quality reductions are acceptable
- Files are being distributed rather than edited
- Bandwidth is limited
Examples include:
- Website images
- Streaming video
- Music distribution
- Email attachments
- Social media uploads
Can Lossy Compression Be Invisible?
Yes.
At high quality settings, differences may be impossible to detect without specialised analysis.
This is why many users cannot distinguish between:
- Original photographs
- High-quality JPEGs
or
- CD-quality audio
- High-bitrate MP3 files
The data has changed, but human perception may not notice.
The Biggest Compression Myth
A common misconception is:
Lossless = Better
This isn’t always true.
A 50 MB PNG may technically preserve more information than a 4 MB JPEG.
However, if viewers cannot perceive the difference, the larger file may offer little practical benefit.
The best compression method depends on the purpose of the file.
Conclusion
Lossless compression reduces file size by finding more efficient ways to store existing information. Every bit of the original data remains intact and can be recovered perfectly.
Lossy compression reduces file size by permanently removing information that the algorithm considers less important. The resulting file is smaller, but portions of the original data are gone forever.
The key difference is not whether the file looks the same. It is whether the underlying data remains identical. Lossless compression preserves it. Lossy compression changes it.
Understanding that distinction makes it easier to choose the right format for images, audio, video, PDFs, and almost every other type of digital file.