Lossy vs lossless the two fundamental categories

Every time you save a JPEG, send a voice note, or zip a folder, you are choosing between two completely different ideas about how to make a file smaller. One keeps every single bit and rebuilds the original exactly. The other quietly throws some data away in exchange for a much smaller file. Knowing which is which stops you from ruining a photo, blurring a logo, or wondering why your archive will not shrink.

Two versions of the same image, one exact and one approximate

The short version

  • Lossless: rebuilds the original byte for byte. Nothing is lost. Used for text, code, spreadsheets, ZIP, PNG, and FLAC. Modest size savings.
  • Lossy: permanently discards data your eyes or ears are unlikely to miss. Used for JPEG, MP3, MP4, and WebP. Large size savings, but the original is gone.

How lossless compression works

Lossless compression finds patterns and redundancy, then writes them down more efficiently. If a file repeats the word "compression" two hundred times, the algorithm can store that word once and reference it. When you decompress, the original is reconstructed exactly, down to the last bit.

The classic example is the ZIP format, which uses an algorithm called deflate. PNG images, FLAC audio, and the GZIP format all work the same way. Because nothing is discarded, you can compress and decompress as many times as you like without any quality change.

The catch is that lossless savings are limited by how much genuine redundancy a file contains. A plain text log might shrink by 80 percent. A file that is already random or already compressed barely moves. That is a separate topic in itself, covered in why some files do not compress much.

How lossy compression works

Lossy compression starts from a different assumption: that the file is meant for human eyes or ears, and humans do not notice everything. So it removes detail that perception is least sensitive to.

A JPEG, for example, breaks an image into small blocks and discards fine colour and brightness variation that the eye tends to overlook. An MP3 removes frequencies that are masked by louder sounds happening at the same moment. An MP4 video reuses parts of the previous frame instead of storing every frame in full.

The result is dramatic. A photo that is 8 MB as a lossless file might be 800 KB as a good-quality JPEG, a tenfold reduction with no obvious difference on screen. The trade-off is permanence: once the detail is gone, no tool can bring it back.

Why "quality" is a slider, not a switch

Lossy formats let you choose how aggressive to be. JPEG, WebP, MP3, and MP4 all expose a quality or bitrate setting. Higher quality keeps more detail and produces a larger file; lower quality throws away more and produces a smaller one.

The art is finding the point where the file is small but the loss is invisible. For most photos a JPEG quality of around 75 to 85 is the sweet spot. Push it too low and you start seeing blocky edges and colour banding, especially in skies and gradients.

The trap of repeated lossy saving

Because lossy compression discards data every time, saving a JPEG, editing it, and saving again compounds the damage. Each generation looks slightly worse, like photocopying a photocopy. This is called generation loss.

The fix is simple: keep a lossless master if you can (the original camera file, a PNG, or a project file), and only export to a lossy format as the final step. If you must re-edit, go back to the master rather than re-opening the compressed copy.

Which one do your files need?

  • Photos and screenshots of photos: lossy (JPEG or WebP). The savings are huge and the loss is invisible at sensible settings.
  • Logos, diagrams, text, and screenshots of text: lossless (PNG). Sharp edges and flat colour survive perfectly, and lossy formats would smear them.
  • Music and video: lossy (MP3, AAC, MP4) for sharing; lossless (FLAC, ProRes) only for archiving or editing.
  • Documents, code, spreadsheets, databases: lossless only. A single changed character can break the file, so nothing may be discarded.


A quick way to tell them apart

Ask one question: if a single bit changed, would the file break or just look slightly different? If it would break (a program, a spreadsheet, a contract), you need lossless. If it would only look or sound a touch worse (a holiday photo, a song), lossy is fair game and will save you far more space.

Can you combine the two?

Yes, and most real files already do. A WebP image can be lossy or lossless depending on the setting. A video file uses lossy compression for the picture but often lossless compression for the subtitle track. When you put a JPEG inside a ZIP, you are wrapping a lossy file in a lossless container, which is why the ZIP barely shrinks it further.

This layering explains a lot of everyday confusion. People sometimes zip a folder of photos hoping to halve its size, then feel cheated when it barely changes. The reason is that the heavy lifting was already done by the lossy JPEG compression inside each photo. The lossless ZIP around them has almost no redundancy left to exploit. Once you can see which layer is doing the compressing, results stop feeling random.

The file extension is a strong hint

You can usually guess the category from the extension alone. PNG, GIF, FLAC, ZIP, 7Z, and TXT are lossless: they preserve the data exactly. JPEG, MP3, AAC, and most MP4 video are lossy: they trade fidelity for size. WebP and HEIC can be either, depending on how they were saved. When in doubt, ask whether the format was designed for perfect data or for human perception, and the answer follows.

This also tells you what to expect when you convert between them. Saving a PNG screenshot as a JPEG will shrink it but soften the crisp text edges. Saving a JPEG photo as a PNG will keep it pixel-for-pixel identical to the already-degraded JPEG while making the file larger, because PNG faithfully preserves every imperfection the lossy step introduced. Neither conversion undoes loss that has already happened.

FAQ

Is lossless always better quality?

It is always a perfect copy, but "better" depends on your goal. For a holiday photo you will never tell the difference, and the lossy version is ten times smaller. For a legal PDF or a program file, lossless is the only safe choice.

Does zipping a JPEG make it lossy?

No. ZIP is lossless, so it never changes the JPEG inside. It also barely shrinks it, because the JPEG is already compressed.

Can I turn a lossy file back into a lossless one?

You can save a JPEG as a PNG, but the detail that was already discarded does not come back. You just get a larger file that preserves the lossy result exactly.

Which uses more CPU?

It varies, but high-quality lossy video and audio encoding is usually the most demanding, because the algorithm is constantly deciding what it can afford to throw away.

Related reading

Comments