Lossless vs lossy compression which to choose

Every image compression decision boils down to one question: are you allowed to throw away data, or not? The answer depends on your content type and your reuse plans.

The terms "lossless" and "lossy" sound technical but the distinction is simple. Lossless compression makes files smaller without changing any pixels. Lossy compression makes files smaller by throwing away some pixel detail you probably won't notice. Which is right depends on what you're doing.

Lossless: nothing changes

A lossless-compressed image, when decompressed, is byte-for-byte identical to the original. Open the file, save it again as the same format, open it again — every pixel is exactly the same as it started.

This is achieved through clever encoding tricks that exploit patterns in the data without removing information. For example: if a row of 100 pixels are all the same color, you can encode that as "100 of this color" instead of storing 100 identical pixel values. The pixels themselves haven't changed.

Formats that are always lossless:

  • PNG — the lossless web image standard.
  • GIF — older, more limited palette.
  • TIFF (with appropriate encoding) — common in professional photography and print.
  • WebP lossless mode — modern alternative to PNG, usually smaller.
  • BMP uncompressed — no compression at all (technically not even lossless because there's nothing to "lose"; it's just uncompressed).

Lossy: visible-quality trade for size

Lossy compression throws away some pixel detail in exchange for dramatically smaller files. The art of lossy compression is throwing away the parts humans don't notice while preserving the parts we do.

Formats that are typically lossy:

  • JPG / JPEG — the most common lossy format.
  • WebP lossy mode — modern, smaller than JPG at the same quality.
  • AVIF — newest, smallest, longest to encode.
  • HEIC / HEIF — Apple's default; lossy compression in the H.265 family.

Lossy compression is non-reversible. Once you save a JPG, the data that was thrown away is gone — re-saving the file doesn't restore it. This matters when editing.

Size difference, in concrete numbers

A 12-megapixel photo, fresh out of an iPhone, compared across formats:

  • BMP uncompressed: 36 MB.
  • PNG (lossless): 12 MB.
  • WebP lossless: 9 MB.
  • JPG quality 95 (lossy): 5 MB.
  • JPG quality 82 (lossy): 1.2 MB.
  • WebP quality 82 (lossy): 800 KB.
  • AVIF quality 82 (lossy): 500 KB.

The same photo. The lossy versions look indistinguishable from lossless to almost everyone. The file sizes differ by 70×. For web delivery, this is enormous.

When lossless is the right choice

Content with sharp edges and text

Screenshots, line art, diagrams, logos, comics. JPG-style compression introduces "ringing" artifacts around sharp edges — the boundary between a black letter and a white background gets a halo of muddy pixels. Lossless preserves crisp edges.

If you can read text in the image, prefer lossless.

Images that will be edited

Every lossy save loses more quality. If you save a JPG, edit it, save again, and repeat, the artifacts compound. After ten generations the image looks visibly degraded.

Master files (the version you actually edit) should be lossless. Compress to lossy only at the final export step for delivery.

Archival storage

Storage is cheap; lost data is gone forever. Photographs you may want to print, edit, or re-process later should live in their original RAW or in lossless format. Compress copies, not originals.

Medical and scientific imaging

Any context where every pixel needs to be authentic. Lossy compression can introduce artifacts that mislead diagnosis or analysis.

When lossy is the right choice

Photographs for web display

Photos have continuous tones and gradients that lossy compression handles extremely well. The quality difference between JPG quality 82 and lossless is imperceptible at normal viewing sizes, but the file size difference is 8-15×.

Anywhere bandwidth matters

Faster page loads. Lower CDN costs. Better mobile experience. Lossy compression makes all of these dramatically better with no perceptible quality cost.

Background and decorative images

If the image is decorative (a header pattern, a divider graphic, a background texture), you can use aggressive lossy compression. Visible artifacts are okay because nobody scrutinizes background images.

The hybrid approach: WebP and AVIF

WebP and AVIF both support lossless and lossy modes. This gives you one format that handles every case:

  • Logo with transparency: WebP lossless.
  • Photo for the same site: WebP lossy at quality 82.

You don't need to mix PNG and JPG anymore. WebP can do both jobs with better compression than either.

Common mistakes

Saving photos as PNG

PNG is lossless, but it's terrible at compressing photographic content. A photo saved as PNG is usually 5-10× larger than the same photo as a high-quality JPG. If someone hands you a photo as a PNG, convert it to JPG or WebP before publishing.

Saving screenshots as JPG

The reverse mistake. JPG smears text and creates haloes around sharp edges. Screenshots become noticeably blurry. Use PNG or WebP lossless for screenshots.

Aggressive compression on detailed content

Quality 60 might be fine for a low-detail landscape photo. The same setting on a portrait with skin tones will produce visible blotching. Test by content type, not just by category.

Re-compressing already-compressed files

Each lossy compression cycle adds artifacts. If your source is a quality-60 JPG that someone sent you, compressing it again to quality 80 doesn't help — you're working from already-degraded content. Either accept the existing quality or get the original.

A decision tree

  1. Does the image have text, sharp edges, or simple graphics? → lossless (PNG or WebP lossless).
  2. Is this the master file you'll edit later? → lossless.
  3. Is it a photograph for web display, social media, or email? → lossy at quality 80-85.
  4. Is bandwidth or page speed critical? → lossy, as aggressive as you can tolerate.
  5. Does it need transparency? → PNG or WebP (either mode supports alpha).

Try both modes with pictoolkit's image compressor. Compare lossless vs lossy output for your specific content type and pick what works.

Keep reading

Related articles