Lossy vs lossless compression

One discards detail permanently to reach a much smaller file. The other guarantees every pixel survives. Which you want depends on what is in the picture.

Side by side

Lossless — what survives
Every pixel value, exactly. Byte-identical on decode.
Lossless — formats
PNG, lossless WebP, GIF, TIFF (LZW).
Lossless — typical saving
0–60%, and near zero on photographs.
Lossy — what survives
Everything you are likely to notice. Fine detail is discarded.
Lossy — formats
JPEG, lossy WebP, AVIF, HEIC.
Lossy — typical saving
60–95% on photographs.
Reversible?
Lossless, yes. Lossy, never.

Choosing between them

The distinction in one sentence each

Lossless rewrites the file so it takes less space while every pixel value survives exactly — decode it and you get the original back, byte for byte.

Lossy throws information away on purpose, choosing what to lose based on the limits of human vision, and cannot be reversed.

That is the whole difference, and everything else follows from it.

Why lossy wins so decisively on photographs

A photograph is mostly noise. Sensor grain means neighbouring pixels differ slightly even in a flat expanse of sky, and lossless algorithms have almost nothing repetitive to collapse. That is why a 12-megapixel photograph saved as PNG is commonly 15–25 MB.

A lossy encoder looks at the same image and asks a different question: which of this detail would anyone actually notice? The answer is very little of the finest detail, and none of the colour resolution. Discarding it produces the same photograph at 1.5 MB.

Ten times smaller, no visible difference. On photographic content the argument is not close.

Why lossless wins just as decisively on graphics

Now invert the content. A screenshot is large flat areas, hard edges and text — enormously repetitive, which lossless compression exploits brilliantly.

Lossy encoders, meanwhile, are built on the assumption that sharp transitions are rare. Give one a black letter on a white background and it cannot represent the edge cleanly, so it produces ringing: faint ghost echoes either side of every stroke. Chroma subsampling compounds it, smearing coloured text into a dirty fringe.

So for graphics the lossless file is frequently both smaller and sharper. There is no trade-off to weigh.

The test that decides it

Ask one question: does this image have large areas of flat, uniform colour and hard edges?

Yes — screenshots, logos, diagrams, charts, line art, text
Lossless. PNG, or lossless WebP for the web.
No — photographs, continuous gradients, complex artwork
Lossy. JPEG, or WebP and AVIF for the web.
Needs transparency
PNG or WebP either way. JPEG has no alpha channel at all.
Will be edited again
Lossless, always. Each lossy save compounds the damage.

Where the terminology gets abused

Be wary of tools advertising "lossless" savings of 70–80% on photographs. That figure is not achievable losslessly, and what is usually happening is palette quantisation — reducing the image to 256 colours — which is a lossy operation whatever the marketing calls it.

Equally, "lossless JPEG compression" almost always means one of two narrower things: stripping metadata without touching the image, or rearranging the existing JPEG data with a tool such as jpegtran. Both are legitimate and both save far less than the phrase implies. JPEG itself has no lossless mode — the quantisation step that discards information is the format, not a setting.

Try it yourself

Everything below runs in your browser, so you can test any of this on your own files without uploading them.

  • Lossless compressor

    Zero quality loss, every pixel preserved exactly. Honest about how modest the saving is.

    Open the tool
  • Compress JPEG

    Shrink JPG and JPEG photographs with a quality slider or an exact target size.

    Open the tool
  • Compress PNG

    Lossless by default, with transparency carried through untouched.

    Open the tool
  • JPG to WebP

    Typically 25–35% smaller at matched quality. The standard web win.

    Open the tool

Questions

Frequently asked questions

Every answer below is present in the page source, expanded, so it can be read without opening anything.

Can I convert a lossy image back to lossless?

You can change the container, but not recover the detail. Saving a JPEG as PNG produces a large, lossless copy of the already-degraded image — every artefact preserved perfectly. The original detail was discarded at the first save and no longer exists in the file.

Is PNG always lossless?

The PNG format is, but tools that produce PNG-8 are not being lossless with your image — they reduce it to a 256-colour palette first, which is a lossy step done before a lossless save. If a tool offers a big PNG saving, check whether it is quantising.

Is WebP lossy or lossless?

Either — it supports both modes, which is unusual and useful. Lossy WebP beats JPEG by roughly 25–35% at matched quality; lossless WebP beats PNG by roughly 25% on the same image. Browser canvas encoders produce the lossy variety.

How much quality does lossy compression actually cost?

At quality 80 on a photograph, essentially nothing you would see at normal viewing size — you have to zoom to 200–400% and look at flat areas such as sky or skin to find differences. Below about quality 60 it becomes visible without looking for it.

Which should I use for images on a website?

Lossy for photographs, lossless for interface graphics and logos, and WebP for both if you can — it covers each case in one format and is smaller than the alternative either way.

What should I archive in?

Neither, ideally: keep the camera original untouched. If you must re-encode for archiving, use a lossless format so that future copies start from something undamaged.

From the blog

Related reading

Longer, more practical guides from the blog.

  • Image Formats

    PNG vs JPEG: When to Use Each, With the File Sizes to Prove It

    PNG stored the same photograph in 1274.1 KB where JPEG needed 67.5 KB — nineteen times larger. On a flat graphic PNG won. On a smooth gradient PNG lost to JPEG by a factor of two, which surprises most people.

    9 min read

  • Image Formats

    WebP vs JPEG: Which Should You Use, and When JPEG Still Wins

    WebP produced a 27.0 KB file against MozJPEG's 41.1 KB on the same photograph at slightly higher measured fidelity — 34% smaller. It also produced a larger file than JPEG on random noise. The advantage is real and content-dependent.

    9 min read

  • Image Compression

    JPEG Quality Settings Explained: What the Number Actually Means

    Quality 80 is not 80% of anything. It is an index into a quantisation table. Measured on one photograph: dropping from 100 to 90 removes 77% of the file and 4.2 dB of fidelity; dropping from 40 to 30 removes 17% and costs almost as much.

    8 min read