All articles
Guides8 min18 October 2026

Lossless vs Lossy Compression: What's the Difference?

There are two main types of file compression. **Lossless** compression makes a file smaller and gives you back every bit of the original when you open it. **Lossy** compression makes a file much smaller by permanently discarding detail that people are unlikely to notice. Both are everywhere — ZIP archives and PNG images are lossless, while JPEG photos and most videos are lossy. This guide explains how each works, what you give up, and which one to choose for photos, graphics, PDFs and documents.

Lossless compression: smaller, but nothing is lost

Lossless compression finds patterns and repetition in data and writes them down more efficiently. If a row of an image is 500 identical white pixels, a lossless format can store "500 × white" instead of repeating the same value 500 times. When the file is opened, the original is rebuilt exactly, bit for bit.

That makes lossless compression the only option for anything where a single changed byte matters: text, spreadsheets, program files, databases and archives. Common lossless formats include ZIP, 7z, gzip, PNG, FLAC audio and lossless WebP.

The trade-off is size. Lossless compression can only remove redundancy, so how much it saves depends entirely on the content: a plain text file may shrink by 60–80%, while a photo that is already compressed barely shrinks at all.

Lossy compression: much smaller by discarding detail

Lossy compression goes further. Instead of only removing repetition, it removes information — the kind human eyes and ears are least sensitive to. A JPEG encoder, for example, keeps brightness detail but simplifies fine colour variation and smooths textures in small blocks. MP3 and AAC audio drop sounds that are masked by louder ones.

The result can be 5 to 20 times smaller than the original while looking or sounding almost the same. The catch is that the discarded data is gone for good: you can't decompress a JPEG back into the original photo. Common lossy formats include JPEG, lossy WebP, AVIF, MP3, AAC and almost every video format (H.264, H.265, AV1).

Side by side

Lossless — exact copy after decompression · moderate savings (often 10–60%) · best for text, documents, code, archives, screenshots and logos · formats: ZIP, 7z, PNG, FLAC, lossless WebP.

Lossy — an approximation of the original · large savings (often 70–95%) · best for photos, audio and video · formats: JPEG, lossy WebP, AVIF, MP3, AAC, MP4.

A useful rule: if the file will be read by a computer (a contract, a spreadsheet, source code), use lossless. If it will be seen or heard by a person (a photo, a podcast, a video), lossy is usually the better choice.

Does compressing a file reduce quality?

Only with lossy compression. A lossless ZIP or PNG never changes the content. A lossy JPEG or WebP does — but at sensible settings the change is invisible. For photos, a quality of 75–85% typically looks identical to the original on screen while being a fraction of the size.

Quality loss becomes visible when you push the setting too low (blocky artefacts, smeared detail, banding in skies) or when you re-compress a file that was already compressed. Each lossy save throws away a little more, so always start from the best original you have rather than editing and re-saving the same JPEG over and over.

Which one should you use?

Photos: lossy. Save as JPEG or WebP at 75–85% quality. Use the JPEG compressor or convert to WebP with JPG to WebP.

Screenshots, logos, diagrams, text in images: keep PNG. These have sharp edges and few colours, where lossy formats create visible fuzz. Shrink them with Compress PNG, which reduces the colour palette — technically a mild lossy step, but invisible on flat graphics.

PDFs: a mix. Text and vector graphics stay lossless; embedded photos are recompressed. MiniFiles' PDF compressor resamples images inside the PDF while text stays perfectly sharp.

Documents, spreadsheets, code and anything you must restore exactly: lossless only. Zip them with your operating system's built-in tool.

Animated GIFs: GIF itself is lossless, but compressing a GIF usually means a lossy reduction of colours and pixel detail to get a usable size.

Is PNG lossless? Is WebP lossless?

PNG is a lossless format: saving an image as PNG never changes its pixels. Many PNG compressors, including MiniFiles, make PNGs smaller by first reducing the number of colours (colour quantisation) — that step is lossy, even though the file is still a PNG.

WebP supports both modes. Lossless WebP is typically 25% smaller than PNG; lossy WebP is usually 25–35% smaller than JPEG at similar quality. MiniFiles produces lossy WebP at the quality you choose.

JPEG is always lossy, even at 100% quality. GIF is lossless but limited to 256 colours per frame.

How MiniFiles compresses your files

MiniFiles runs every compression in your browser, so your files never leave your device. Each format uses the method that suits it: lossy re-encoding for JPEG and WebP, colour-palette reduction for PNG, gifsicle for animated GIFs, and Ghostscript for PDFs, which resamples images while keeping text and vectors lossless. You can see the original and compressed size before downloading, and compare the two side by side.

Want to know more about what happens inside a compressed file? Read how file compression works.

Key takeaways

  • Lossless compression (ZIP, 7z, PNG, FLAC, lossless WebP) rebuilds the original data exactly; lossy compression (JPEG, lossy WebP, AVIF, MP3, MP4) permanently discards detail for much smaller files.
  • Use lossless for documents, code, archives, screenshots and logos; use lossy for photos, audio and video.
  • JPEG and WebP photos at 75–85% quality usually look identical to the original on screen.
  • PNG is a lossless format, but many PNG compressors reduce the colour palette first, which is a lossy step.
  • MiniFiles compresses images and PDFs in the browser without uploading them, using lossy re-encoding for JPEG/WebP, palette reduction for PNG, gifsicle for GIF and Ghostscript for PDF.

Frequently asked questions

What are the two main types of data compression?

Lossless compression, which rebuilds the original data exactly, and lossy compression, which permanently removes detail people are unlikely to notice in exchange for much smaller files.

Is lossless compression better than lossy?

Neither is better in general. Lossless is required for documents, code and archives that must be restored exactly; lossy is better for photos, audio and video, where it makes files many times smaller with no visible difference.

Does lossy compression always reduce quality?

It always removes some data, but at sensible settings — around 75–85% for JPEG and WebP photos — the difference is usually invisible on screen. Quality loss becomes visible at very low settings or after repeated re-saving.

Is ZIP compression lossless?

Yes. ZIP, 7z and gzip are lossless: unzipping gives back exactly the original files.

Can you undo lossy compression?

No. The detail removed by lossy compression is gone for good. Keep your original files if you may need full quality later.

Which compression is best for photos?

Lossy compression with JPEG or WebP at 75–85% quality. It keeps photos looking the same while making them several times smaller.

Try it now — free

Compress PNG, JPEG, and PDF files in your browser. No upload, no installation.

Compress files