Skip to content
FundamentalsCompression

Lossy vs Lossless Compression, Explained

What's the real difference between lossy and lossless compression? When to use each, how quality and file size trade off, and which formats use which.

Maya BauerJune 27, 20266 min read

Almost every file you send, upload, or store has been compressed in some way. Compression is what lets a two-hour movie fit on a disc and a high-resolution photo travel over a slow connection. But not all compression is the same. The single most important distinction is whether it is lossy or lossless — and understanding the difference will help you pick the right format and the right settings every time.

What is lossless compression?

Lossless compression makes a file smaller while preserving every single bit of the original data. When you decompress it, you get back a perfect, byte-for-byte copy. It works by finding and removing statistical redundancy — repeated patterns, predictable sequences, runs of identical values — and encoding them more efficiently.

The classic example is a ZIP archive: unzip it and your documents are exactly as they were. Image formats like PNG and audio formats like FLAC are lossless too. The trade-off is that lossless compression can only shrink files so far — typically to somewhere between 50% and 90% of the original size, depending on the content. Data that is already random or already compressed barely shrinks at all.

What is lossy compression?

Lossy compression goes further by permanently discarding information — specifically, information that humans are least likely to notice is missing. A JPEG photo throws away subtle color and detail your eye tends to overlook; an MP3 drops sounds that are masked by louder ones. The result is dramatically smaller files: a JPEG can be a tenth the size of the equivalent lossless image, with no obvious difference at normal viewing sizes.

The catch is in the name: the discarded data is gone for good. Push the quality too low and you start to see the cost — blocky artifacts in images, muddy or tinny audio, smeared video. And because the loss is permanent, it is cumulative: every time you re-save a lossy file at a lossy setting, it degrades a little more.

When should you use each?

Use lossless when fidelity is non-negotiable:

  • Logos, icons, line art, and screenshots (PNG keeps edges crisp).
  • Images with transparency.
  • Master copies you will edit again later.
  • Text, code, spreadsheets, and any document data.

Use lossy when small size matters and minor, usually-invisible loss is acceptable:

  • Photographs and realistic images on the web (JPEG, WebP, AVIF).
  • Music and podcasts for listening (MP3, AAC).
  • Video for streaming, social, or email (H.264 and friends).

A quick format cheat-sheet

Many modern formats actually support both modes. WebP and AVIF, for instance, have lossy and lossless variants. Here is the short version:

  • Lossless: PNG, GIF, FLAC, WAV (uncompressed), ZIP, lossless WebP/AVIF.
  • Lossy: JPEG, MP3, AAC, H.264/H.265, VP9, lossy WebP/AVIF.

For a deeper reference on how browsers handle these, the MDN guide to image file types is excellent.

The practical takeaway

Start from your highest-quality original and compress once, to the format that fits the job. For photos headed to the web, a lossy JPEG, WebP, or AVIF at quality 70–80 is almost always the right call. For graphics and anything with text or transparency, reach for lossless PNG. And whatever you do, keep a pristine master so you never have to re-compress an already-compressed file.

Every tool on FileShrinking runs entirely in your browser, so you can experiment freely — try compressing an image at a few different quality levels and compare. Your files never leave your device, so there is no risk in testing.