Image Compression

Lossless vs Lossy Image Compression — What's the Difference?

Understand the difference between lossless and lossy image compression. Learn which formats use each method, when to choose one over the other, and how much you can compress before quality suffers.

Lossless compression preserves every pixel; lossy compression trades some imperceptible detail for dramatically smaller files. Choosing the right method depends on your image type and how you plan to use it.

What Is Lossless Compression?

Lossless compression finds patterns in image data and encodes them more compactly — without throwing anything away. When you open a losslessly compressed file, the decoder reconstructs the original data exactly.

Think of it like a zip file for text: the compressed archive is smaller, but unzipping it gives you back every character of the original document.

PNG is the most common losslessly compressed image format on the web. A PNG file decoded in a browser contains exactly the pixels that were in the source. This makes PNG ideal for:

  • Logos and wordmarks with flat colours
  • Screenshots and UI mockups
  • Images with transparent backgrounds
  • Any graphic you’ll edit and save repeatedly

The downside: lossless compression is less efficient for photographs. A PNG of a typical photo is often 3–5× larger than an equivalent JPEG.

What Is Lossy Compression?

Lossy compression achieves far greater file size reductions by permanently discarding image data that’s difficult for humans to perceive. It exploits known properties of human vision — we’re less sensitive to fine colour detail than to luminance (brightness) transitions, for example.

JPEG is the dominant lossy format for photographs. A JPEG encoder breaks the image into 8×8 pixel blocks, applies a discrete cosine transform, and quantizes the result — discarding high-frequency detail based on a quality setting. The higher the quality setting, the less data is thrown away.

The tradeoff: JPEG compression is one-way. You cannot recover discarded detail. Re-saving a JPEG at a lower quality setting compounds the loss — each re-save introduces additional artefacts.

WebP: The Format That Does Both

WebP, developed by Google, supports both lossless and lossy compression in the same format. This makes it unusually flexible:

  • WebP lossy outperforms JPEG by roughly 25–34 % at equivalent visual quality
  • WebP lossless outperforms PNG by roughly 26 % in file size

Most modern browsers support WebP natively. Using WebP for web images — lossy for photos, lossless for graphics — is one of the highest-impact optimisations for page load speed. ImgKit’s image tools include converters for WebP.

Format Summary

Format Compression type Best use case
PNG Lossless Logos, graphics, screenshots, transparency
JPEG Lossy Photographs, web images
WebP Lossless or lossy Web images (all types)
GIF Lossless (8-bit) Simple animations
AVIF Lossless or lossy Next-gen web images
TIFF Usually lossless Print, archival

Quality vs File Size Trade-Off

The quality-to-size trade-off in lossy formats is not linear. Moving from quality 100 to 85 cuts file size dramatically while the visual change is nearly invisible. Moving from quality 60 to 50 produces a noticeable jump in artefacts for a comparatively small additional size reduction.

A practical framework:

  • Web photos (hero images, blog): JPEG quality 80–85 or WebP quality 75–80
  • Web photos (thumbnails): JPEG quality 70–75 or WebP quality 65–70
  • Print delivery: PNG or TIFF lossless, or JPEG quality 95+
  • Archival masters: Always lossless (PNG, TIFF, or original RAW)

Practical Recommendations

Use lossy compression when:

  • You’re delivering photos for a website or email
  • File size affects load time or attachment limits
  • The image won’t be edited further

Use lossless compression when:

  • The image contains text, sharp lines, or flat colours
  • You’ll re-open and re-save the file multiple times
  • Pixel-perfect accuracy is required (medical imaging, print pre-press)

For tools that let you compare both approaches and find the right balance, browse the related guides section on compression techniques and target file sizes.

FAQ

What is lossless compression?

Lossless compression reduces file size by encoding data more efficiently without discarding any information. When you decompress a losslessly compressed file, you recover every original bit exactly. PNG uses lossless compression; a PNG decoded always matches the source pixel-for-pixel.

What is lossy compression?

Lossy compression achieves smaller file sizes by permanently discarding some image data — typically fine detail and colour transitions that are hard for the human eye to detect. JPEG is the classic lossy format. Once compressed, the discarded data cannot be recovered.

Which image formats are lossless?

PNG, GIF, and BMP are always lossless. WebP and AVIF support both lossless and lossy modes. TIFF can be saved losslessly (uncompressed or LZW). RAW camera files are lossless. JPEG is always lossy — there is no lossless JPEG in common use.

When should I use lossless vs lossy compression?

Use lossless for logos, screenshots, text-heavy graphics, UI elements, and any image you will edit and re-save multiple times. Use lossy for photographs shared on the web or in email, where smaller file sizes matter and pixel-perfect fidelity is not required.

How much can you compress an image before the quality loss becomes visible?

For JPEG, quality settings of 80–90 % are generally indistinguishable from the original at normal viewing sizes. Below 60 % compression artefacts (blockiness, colour banding) become noticeable. For WebP lossy, quality 75–85 % delivers excellent results at smaller file sizes than equivalent JPEG.

Related guides

Read next