One guarantees exact pixels forever. The other throws detail away and hopes you cannot see it. Almost every argument about image compression is really an argument about which promise you need.
The distinction is not "good" versus "bad" quality. It is whether the decoder can reproduce the original bytes exactly.
Both are legitimate. The mistake is expecting lossy output to behave like a master file.
Lossless is not about visible quality — it is about being able to re-run a pipeline without accumulating damage.
A lossless photograph is usually two to four times the size of a good lossy copy at the same visual quality. Lossless earns its cost on masters, screenshots, icons and anything that will be edited again — not on a thumbnail destined for a web page.
That PNG saving is still lossless: deflate and filtering remove redundancy without touching a pixel.
Lossy compression is not random damage. It removes specific things, in a specific order, and the order is what makes it predictable.
Encoders discard two kinds of data. First, colour resolution: chroma is subsampled, because human vision resolves brightness far more precisely than hue. Second, high-frequency detail: fine texture and sharp edges are stored coarsely, because the eye's sensitivity to them falls off quickly.
Those decisions are why the artefacts appear where they do. Subsampling damages saturated colour and thin coloured type. High-frequency truncation damages text, line art and hard edges. Smooth gradients suffer from quantisation rather than either — which is why a sky can band long before a face looks soft.
Re-encoding a lossy file asks the encoder to compress an image that already contains quantisation noise. That noise is exactly the high-frequency detail the next pass is designed to drop, so the encoder spends bits on it or throws it away — either way, the result is worse than encoding once from the original. Compress once, and keep the master.
The full ordering of stages is on how image compression works.
It means "we removed detail and you cannot see it at normal viewing size". That is a claim about perception, testing conditions and output size — not a guarantee.
Quality 85 on a photograph is usually indistinguishable at 100% on a good display. The same file inspected at 300% will show ringing. Both statements are true; only one is relevant to shipping.
Treat near-lossless as a starting range, not a certificate. If the image is a master, or will be re-edited, or is going to print at large size, use lossless and accept the bytes. For delivery, the near-lossless workflow is the right default.
Four rules cover almost every real folder. The format pages cover the exceptions.
The measured versions of these tradeoffs are on the benchmarks page.
Both. WebP contains a lossy codec (VP8) and a separate lossless codec (VP8L); the encoder chooses based on your settings. A WebP file does not announce which one produced it.
Yes for the file itself — PNG stores pixels exactly, so re-saving never degrades them. But converting a JPEG to PNG preserves the damage the JPEG already did; it just stops adding more.
AVIF supports both, though in practice it is almost always used lossy. Its lossless mode is rarely competitive with PNG or lossless WebP.
Usually from the format, not from a flag. JPEG and WebP are ambiguous by design; PNG and TIFF are lossless by definition.
On photographs, 10–40% from better entropy coding. On flat graphics, 60–80% — PNGs of UI are notoriously wasteful.
There is no standard number. On photographs, quality 85 is a common working definition at 100% view. Treat it as a heuristic and verify on your own images.
Lossless for PNG and WebP, quality control for JPEG and AVIF — per folder, in one pass.