Lossy vs Lossless Compression: What's the Difference?
The TL;DR
Lossy compression throws away data you (hopefully) won't miss to make files much smaller. JPG photos, MP3 music, and H.264 video are lossy. Lossless compression keeps every bit of the original data intact — the file is smaller but can be perfectly reconstructed. PNG images, FLAC audio, and ZIP archives are lossless.
How Lossy Compression Works
Lossy algorithms exploit the limits of human perception. JPG discards high-frequency color information that your eyes can't easily distinguish. MP3 removes frequencies that are masked by louder sounds. H.264 video reuses data between similar frames. The result: a JPG can be 10× smaller than the equivalent lossless image with no visible quality difference at higher quality settings.
How Lossless Compression Works
Lossless compression finds patterns and redundancy in data without removing any information. If a row of pixels is 'blue blue blue blue blue,' lossless compression stores '5× blue' instead of listing each pixel separately. The original data can be perfectly reconstructed. ZIP, GZIP, and LZ4 all work this way. The trade-off: less dramatic compression ratios — typically 2-3× reduction instead of 10-20×.
When to Use Which
Use lossy for: sharing photos online, streaming music, sending videos — anywhere file size matters and perfect quality doesn't. Use lossless for: archival storage, professional editing, medical imaging, text documents, source code — anywhere the original data must be preserved exactly. Many professional workflows capture in lossless, edit in lossless, and export to lossy for distribution.
Common Formats by Type
Lossy images: JPG, WebP (lossy mode), AVIF (lossy mode), HEIC. Lossless images: PNG, TIFF, WebP (lossless mode), BMP, GIF (256 colors max). Lossy audio: MP3, AAC, OGG Vorbis, Opus. Lossless audio: FLAC, ALAC, WAV (uncompressed). Lossy video: H.264, H.265, VP9, AV1. Lossless video: FFV1, Lagarith (very rare — lossless video files are enormous).