Image glossary

Lossless compression

Also known as lossless

Lossless compression makes a file smaller by encoding redundancy more efficiently, and decompression returns data bit-for-bit identical to the input.

How it works

Lossless compression exploits the fact that real data repeats itself. The simplest illustration is run-length encoding: forty identical white pixels stored as "white x 40" instead of forty values. Real formats are more sophisticated — prediction from neighbouring pixels, then an entropy coder that assigns shorter codes to more frequent symbols — but the principle holds. Find structure, describe it more briefly, and be able to reverse the description exactly.

Because nothing is discarded, the process can be repeated indefinitely with no effect. Decompress a PNG and re-save it a hundred times and the hundredth file is identical to the first.

It is a guarantee, not a quality setting

The most common misunderstanding about lossless compression is that it means better quality. It means identical to the input. If the input is a quality-60 JPEG, a lossless conversion faithfully preserves quality-60 artefacts in a much larger file. Lossless preserves damage as carefully as it preserves detail.

This also means "quality 100" in a lossy codec is not lossless. It is the most expensive lossy setting, still transforming and quantizing, just very finely. If you want lossless output you have to ask for it explicitly; the formats support it as a distinct mode.

What it suits

Content built from flat colour and hard edges, where redundancy is high and lossy artefacts are most visible: screenshots, diagrams, charts, line art, logos, UI assets, anything with text.

Also anything that will be edited again. A master kept losslessly can be exported to any lossy format later without inheriting a previous generation's damage. Archives and originals belong in this category by default.

It suits photographs badly for delivery. A photograph has almost no exploitable redundancy, so a lossless photograph is enormous — often ten to fifteen times a visually identical lossy file. Keeping a lossless photographic master is right; shipping one to a browser is not.

Tools that work with this

Back to the full glossary.