The distinction in one line
Lossless compression describes the same data more compactly. Nothing is lost; the original is perfectly reconstructable.
Lossy compression throws data away and keeps a good approximation. The thrown-away part is gone permanently.
That is the whole idea. Everything below is consequences.
How lossy compression gets away with it
It sounds reckless to discard parts of a picture. It works because human vision is uneven.
We are very good at seeing brightness and broad shapes, and comparatively poor at seeing fine colour variation and high-frequency detail. JPEG exploits exactly that: it converts blocks of the image into frequency components and discards the ones the eye is worst at noticing.
At sensible settings the result is genuinely indistinguishable from the original at normal viewing sizes — while being roughly a tenth of the size. On our fixed test image, 3.97 MB losslessly against 375 KB lossily.
That is a remarkable trade, and it is why nearly every photograph you have ever seen on a screen was lossily compressed.
Where lossy compression fails
The same mechanism that makes JPG excellent for photographs makes it terrible for text.
A hard black letter against white paper is high-frequency detail. Discarding high-frequency detail is what the codec does. So you get grey haloing around every character — obvious at a glance, and permanent.
This is why screenshots belong in PNG and photographs do not. It is not a quality-setting problem; it is structural.
Generation loss
Here is the consequence people meet without understanding it.
Open a JPG, edit it, save it. Open it again, edit, save. Repeat. The image degrades each time, because each save discards detail from an image that had already lost some.
Lossless formats have no such behaviour. A PNG saved a thousand times is bit-for-bit what it started as.
The practical rule: edit in a lossless format, export to a lossy one at the end. Not the other way round, and never repeatedly.
The misconception worth correcting
“I’ll convert my JPG to PNG to stop losing quality.”
Half right, and the half that is wrong causes real disappointment.
PNG will faithfully preserve whatever it is given — but what it is given is the output of JPG compression, detail already discarded. You get a perfect copy of a damaged picture, at roughly six times the size.
Converting JPG to PNG is a way to stop losing quality from this point forward. It is not restoration. Nothing is.
Lossless compression is not magic either
It is easy to assume lossless means “no compression”. It does not — it means no loss.
A PNG finds genuine patterns: runs of identical pixels, rows that resemble the one above, and encodes them compactly. On a screenshot with large flat areas, that works superbly. On a photograph, where every pixel differs slightly from its neighbour, there is very little exact repetition to find, so the file stays large.
You can also optimise a lossless file losslessly — searching for a more efficient encoding of exactly the same data. That is what oxipng does, and on our photographic test image it recovered 15% without altering a single pixel.
Which formats are which
| Format | Compression |
|---|---|
| PNG | Lossless |
| JPG | Lossy |
| WebP | Both — lossy in normal use |
| AVIF | Both — lossy in normal use |
| HEIC | Lossy in normal use |
Choosing, in practice
Use lossy for photographs going anywhere — email, a website, a print service. The saving is enormous and the loss is invisible.
Use lossless for screenshots and diagrams, for any working copy you will edit again, and for anything where a pixel being exactly right matters.
Never convert repeatedly between lossy formats. Each hop discards more, and spends bits faithfully reproducing the previous format’s artefacts. Go from your best available source, once.