Lossy vs Lossless Compression: What You Need to Know
Learn the difference between lossy and lossless compression for images and audio. Understand when quality loss matters and when it doesn't.
Convert-To Editorial Team
Editorial PolicyYou've used ZIP compression before: select a folder, compress it, and the resulting archive is smaller. Extract it later and every file is identical to the original — every byte, every pixel, every character. Now imagine a different kind of compression where the extracted files are slightly different from the originals. Not corrupted, just simplified. The text is all there, but the images are a little softer, the audio a little thinner. That's the fundamental divide between lossless and lossy compression, and understanding the difference affects every decision you make about file formats, from choosing between JPG and PNG for a photograph to selecting between MP3 and FLAC for a music library.
What "Lossy" and "Lossless" Actually Mean
Lossless compression reduces file size without discarding any data. When you decompress a lossless file, you recover the original bit-for-bit. ZIP, PNG, FLAC, and TIFF (with LZW compression) are all lossless — the compression is fully reversible.
Lossy compression reduces file size by permanently removing data the algorithm deems expendable. JPG discards fine visual detail that human eyes are least sensitive to. MP3 removes audio frequencies that fall below the threshold of human hearing. The original data cannot be recovered from a lossy-compressed file, no matter what software you use.
| Property | Lossy Compression | Lossless Compression |
|---|---|---|
| Data after decompression | Approximation of original | Exact copy of original |
| Typical file size reduction | 80-95% | 20-60% |
| Quality impact | Some loss (often imperceptible) | No loss whatsoever |
| Reversibility | Irreversible | Fully reversible |
| Common formats (image) | JPG, WebP (lossy), HEIC | PNG, TIFF, BMP, WebP (lossless) |
| Common formats (audio) | MP3, AAC, OGG Vorbis | FLAC, ALAC, WAV (uncompressed) |
| Primary use case | Distribution, web delivery | Archival, editing, production |
How Lossy Compression Decides What to Discard
Lossy compression isn't random. It relies on decades of research into human perception — specifically, what our eyes and ears can't detect under normal conditions.
For images (JPG, WebP lossy), the process works in stages:
-
Color space conversion — The image is converted from RGB to YCbCr, separating brightness (luminance) from color (chrominance). Human vision is far more sensitive to brightness changes than color changes, so the chrominance channels can be stored at lower resolution (a technique called chroma subsampling, typically 4:2:0).
-
Block division — The image is divided into 8x8 pixel blocks (JPG) or variable-size blocks (WebP).
-
Frequency transform — Each block is transformed into frequency components using the Discrete Cosine Transform (DCT). Low frequencies represent smooth gradients and large shapes; high frequencies represent fine detail, sharp edges, and noise.
-
Quantization — This is where data is actually discarded. The high-frequency components are divided by a quantization factor and rounded to zero. The higher the compression, the more aggressive the rounding, and the more detail disappears.
-
Entropy coding — The remaining non-zero values are compressed further using lossless techniques (Huffman coding or arithmetic coding).
For audio (MP3, AAC), a similar perceptual model applies. The encoder uses a psychoacoustic model to identify frequencies masked by louder neighboring frequencies (auditory masking) and frequencies below the threshold of human hearing. These are reduced or removed before the remaining audio is compressed.
How Lossless Compression Preserves Everything
Lossless compression finds and eliminates redundancy without removing unique information. The most common techniques include:
-
Run-length encoding (RLE) — Instead of storing "white, white, white, white, white," store "5x white." This is why screenshots with large areas of solid color compress so efficiently in PNG.
-
Dictionary-based compression (LZ77, LZW) — The algorithm builds a dictionary of repeating patterns and replaces them with shorter references. This is how ZIP, GZIP, and PNG's DEFLATE work.
-
Prediction filters — PNG uses row filters that predict each pixel based on its neighbors. Instead of storing absolute values, it stores the difference between the prediction and the actual value. Differences tend to be small numbers that compress well.
-
Entropy coding — Frequently occurring values are assigned shorter codes (Huffman coding). In an image with mostly white pixels, white gets a very short code while rare colors get longer ones.
The key constraint: lossless compression can only reduce file size as much as the data contains redundancy. A photograph of a complex natural scene has little redundancy — every pixel is slightly different from its neighbors — which is why PNG photographs are 5-10x larger than their JPG equivalents. A screenshot with a white background and black text has enormous redundancy, making PNG compression extremely efficient for that content.
Compression Ratios: The Numbers
The gap between lossy and lossless is significant. Here's what typical compression looks like for a 1920x1080 image (uncompressed size: approximately 6.2 MB in 24-bit RGB):
| Format | Compression Type | Typical Size | Compression Ratio | Quality |
|---|---|---|---|---|
| BMP (uncompressed) | None | 6,220 KB | 1:1 | Perfect |
| PNG | Lossless | 2,800 KB | 2.2:1 | Perfect |
| WebP (lossless) | Lossless | 2,100 KB | 3.0:1 | Perfect |
| JPG (quality 95) | Lossy | 650 KB | 9.6:1 | Near-perfect |
| JPG (quality 85) | Lossy | 350 KB | 17.8:1 | Minimal artifacts |
| WebP (quality 80) | Lossy | 190 KB | 32.7:1 | Minimal artifacts |
| JPG (quality 50) | Lossy | 120 KB | 51.8:1 | Noticeable softening |
| JPG (quality 20) | Lossy | 48 KB | 129.6:1 | Heavy artifacts |
For audio, the pattern is similar. A 3-minute song at CD quality (44.1 kHz, 16-bit, stereo) has an uncompressed size of about 31.7 MB (WAV):
| Format | Compression Type | Typical Size | Compression Ratio |
|---|---|---|---|
| WAV | None | 31,700 KB | 1:1 |
| FLAC | Lossless | 19,000 KB | 1.7:1 |
| MP3 (320 kbps) | Lossy | 7,200 KB | 4.4:1 |
| MP3 (128 kbps) | Lossy | 2,880 KB | 11.0:1 |
| AAC (128 kbps) | Lossy | 2,880 KB | 11.0:1 |
The trade-off is clear: lossy compression achieves dramatically smaller files, but lossless compression maintains mathematical perfection.
Formats by Compression Type
Not every format fits neatly into one category. Some formats support both modes, and some use no compression at all.
| Category | Image Formats | Audio Formats | Document Formats |
|---|---|---|---|
| Uncompressed | BMP, raw TIFF | WAV, AIFF | — |
| Lossless only | PNG, GIF | FLAC, ALAC | — |
| Lossy only | JPG | MP3, OGG Vorbis | — |
| Both modes | WebP, TIFF, HEIF | — | — |
| Internal compression | — | — | PDF (various), DOCX (ZIP-based) |
WebP is notable for offering both lossy and lossless compression in the same format. You choose the mode at export time. HEIF (and its video-derived variant HEIC used by Apple) also supports both modes, defaulting to lossy for photographs.
The One-Way Door: Why Lossy Compression Is Irreversible
This is the most commonly misunderstood aspect of compression: converting a lossy file to a lossless format does not recover lost quality.
When you convert a JPG to PNG, the PNG faithfully preserves every pixel in the JPG — including all the compression artifacts. The file gets larger (because PNG doesn't discard anything), but the visual quality is identical to the JPG. The lost detail is gone permanently; it was discarded during the original JPG encoding.
The reverse is worse: converting a lossless file to lossy and then back to lossless applies lossy compression once, embedding the artifacts permanently. This round-trip damages the file with no benefit.
A practical analogy: lossy compression is like summarizing a book. The summary is shorter and captures the key ideas, but you can't reconstruct the original word-for-word text from the summary. Lossless compression is like abbreviating a book using shorthand — it's shorter and fully recoverable because every abbreviation maps back to a specific word.
If you've already saved a file in a lossy format and need to edit it, convert it to a lossless format (like JPG to PNG) before making changes. This doesn't recover lost quality, but it prevents further quality loss from re-compression during your editing workflow. Save to lossy only once, at the very end.
When Lossy Compression Is the Right Choice
Lossy compression isn't inherently bad — it's an engineering trade-off. The right situations for lossy compression:
Web delivery: A website serving a 5 MB PNG photograph to every visitor wastes bandwidth. The same image as a 200 KB JPG at quality 85 loads 25x faster and looks identical on screen. For a page with 20 product images, that's the difference between a 100 MB page load and a 4 MB one.
Social media and messaging: Platforms like Instagram, WhatsApp, and Twitter re-compress uploaded images anyway. Uploading a lossless PNG that gets re-encoded to JPG by the platform provides no quality advantage — the platform's encoder makes the lossy decision regardless.
Streaming audio: A podcast encoded as FLAC would consume approximately 4x more bandwidth than MP3 at 128 kbps. For spoken word content, where the frequency range is limited and background noise is common, the quality difference is inaudible to most listeners.
Storage-constrained environments: A phone with 64 GB of storage can hold roughly 12,000 photographs as JPG (at ~5 MB each) or roughly 2,000 as PNG (at ~30 MB each). For most phone photography, the JPG trade-off makes sense.
When Lossless Compression Is Worth the File Size
Certain workflows demand lossless quality, regardless of file size:
Professional editing and production: Photographers, graphic designers, and audio engineers work from lossless masters. Every edit, filter, and adjustment is applied to the full-quality data. Lossy originals limit what editing can achieve — you can't sharpen detail that was already discarded by compression.
Medical and scientific imaging: An X-ray or microscopy scan compressed with lossy algorithms could lose diagnostically relevant detail. Medical imaging standards (DICOM) support lossless compression specifically for this reason.
Archival and preservation: Libraries, museums, and record labels archive in lossless formats (TIFF for images, FLAC for audio) because future technology may benefit from the full original data. Lossy compression is a one-way decision — once detail is removed, it cannot be restored regardless of future advances.
Text and line art: Screenshots, scanned documents, architectural drawings, and QR codes contain sharp edges and precise detail that lossy compression handles poorly. A QR code saved as JPG at low quality may become unscannable because the compression blurs the precise boundaries between black and white modules.
Audio mastering: A mastering engineer working on a final album mix uses 24-bit WAV or FLAC throughout production. Converting to MP3 at any point in the chain introduces artifacts that subsequent processing can amplify. The MP3 export happens once, at the very end, for consumer distribution.
When compressing files online, the original uncompressed data is uploaded before compression is applied. If your files contain sensitive information (medical records, confidential documents, personal photographs with GPS metadata), consider whether online compression is appropriate. When you convert a file on Convert-To.co, it is processed by CloudConvert, a GDPR-compliant and ISO 27001 certified service. All files are automatically deleted within 15 minutes after conversion. Convert-To.co does not store your files on its own servers. For highly sensitive material, offline tools like ImageOptim or FFmpeg provide local compression without any upload. See our file conversion privacy guide for more detail.
Related Tools and Resources
- Image Compressor — reduce image file size with quality control
- JPG to PNG Converter — convert lossy JPG to lossless PNG for editing
- PNG to JPG Converter — convert lossless PNG to compact JPG for sharing
- JPG to WebP Converter — compress images for web delivery
- MP3 to WAV Converter — convert compressed audio to uncompressed WAV
- FLAC to MP3 Converter — convert lossless audio to compact MP3
- JPG format guide — how JPG compression works in detail
- PNG format guide — understanding lossless PNG compression
- JPG vs PNG vs WebP — choosing the right image format
- Why Images Lose Quality — troubleshooting quality degradation
- MP3 vs WAV vs FLAC — comparing audio format trade-offs
Tags
Related Guides
The Complete Guide to File Formats and Conversion
A comprehensive guide to understanding file formats and converting between them. Covers documents, images, audio, and more.
ExplainerHow OCR Works: Extracting Text from Images and PDFs
Learn how Optical Character Recognition (OCR) technology works and how it enables text extraction from scanned documents and images.
TroubleshootingWhy Do Images Lose Quality? How to Prevent It
Understand why images lose quality during conversion and compression. Learn techniques to minimize quality loss when converting between formats.
ExplainerImage Resolution Explained: DPI vs PPI
Understand image resolution, DPI, and PPI. Learn how resolution affects print quality and screen display.
Try It Now
Ready to use PNG to JPG? Convert your files for free with our online tool.
Use PNG to JPG →Try It Now
Ready to use JPG to WEBP? Convert your files for free with our online tool.
Use JPG to WEBP →Try It Now
Ready to use Compress Image? Convert your files for free with our online tool.
Use Compress Image →