What Is Lossless Compression?

One kind of compression gives every pixel back exactly. The other throws some away for good. Knowing which you're using decides what you can undo.

Illustration of a kitchen counter where hands vacuum-seal a bag of coffee beans, next to a full pouch and a jar holding the same beans

Lossless compression makes a file smaller and can give you back every original pixel, exactly. Lossy compression makes a file smaller by throwing some of the picture away, permanently. Both are called compression, and the difference between them decides what you are able to undo later.

Vacuum-sealing a bag of coffee is lossless: you have removed the air, not the beans, and everything you put in comes back out. Lossy is closer to grinding some of the beans away because you decided you would not miss them. The bag is lighter either way. Only one of those is reversible.

How a file gets smaller without losing anything

By describing repetition more briefly. If a row contains two hundred identical white pixels, a lossless format can record “two hundred white” instead of writing white two hundred times. Nothing is lost — the instruction rebuilds the row perfectly. This is why the amount you save depends entirely on how repetitive the image is.

Lossless returns the original; lossy does not Two rows. The lossless row shows an image compressed and then restored to an identical copy. The lossy row shows an image compressed and restored to an approximation, with detail permanently missing. LosslessLossy compressopen it again identical approximate
Lossy gets smaller because it keeps less. That is the trade, and it only runs one way.

A screenshot, a logo, a chart, a line drawing — flat areas of identical colour, so lossless works beautifully. A photograph is the opposite: a blue sky that looks uniform is thousands of slightly different blues, and there is almost no exact repetition to shorten. That is why compressing a PNG photo disappoints people. Nothing is broken. There is simply nothing repetitive to squeeze.

Which formats are which

PNG is lossless. JPG is lossy — it was designed for photographs, where discarding detail your eye does not track is a very good trade. GIF is lossless per frame but capped at 256 colours, which is its own kind of loss.

WebP is the interesting one: it does both. PNG to WebP exposes a quality slider, and pushed to exactly 1 the browser switches to lossless WebP — a pixel-identical copy, usually smaller than the PNG it came from. Anywhere below 1 is lossy. It is the same slider either way, which surprises people.

Why it matters more than it sounds

Because lossy loss accumulates. Every time you open a JPG, edit it and save again, it is re-compressed and loses a little more — and those losses stack, invisibly, until one day the photo looks obviously rough and there is no undo. Lossless formats do not do this; you can round-trip a PNG a thousand times and get the same pixels back.

The practical rule: keep a lossless master, export lossy copies. Edit the PNG, publish the JPG. If you must work in JPG, do all your edits in one sitting and save once — see compressing a JPG for where the quality line actually sits.

And if a file simply has to be small, lossless may not get you there. Hitting a hard limit like 100KB is usually a lossy job, because you are asking for a specific number rather than the best honest saving.

FAQ

Is PNG always smaller than JPG?
No — usually the reverse for photographs, often by a lot. PNG wins on flat graphics, screenshots and anything with transparency. For a photo, a good-quality JPG is typically far smaller and looks the same.

Does compressing a PNG lose quality?
No. PNG compression is lossless, so the pixels come back exactly. What changes on this site is the colour-depth option — reducing how many distinct colours are stored, which does change the image, and which the tool tells you about.

Can I turn a lossy JPG back into a lossless original?
No. The discarded detail is gone. Converting a JPG to PNG gives you a lossless copy of the damage — a perfect record of an imperfect image, usually in a bigger file.

← Back to all guides