What it is
PNG predicts each pixel from its neighbours, stores the difference, and then compresses the differences with the same general-purpose algorithm a ZIP archive uses. Nothing is discarded. Decode a PNG and you get back exactly the pixels that went in, which is what lossless means and why the format is the right home for anything that will be edited again.
The cost follows directly from the mechanism. Prediction works when neighbouring pixels are similar, which is true of a flat background and false of photographic grain. A noisy photograph defeats the predictor, the differences stay large and random, and the compressor has nothing to work with — so the file approaches the size of raw storage.
Where it opens
The rows below are about software a file will actually be handed to, not about a specification. A format is supported when the person you sent it to can open it.
| Where | What happens |
|---|---|
| Every browser | Universal, transparency included. |
| Windows and macOS | Opens everywhere, alpha preserved. |
| Print workflows | Accepted, and preferable to JPEG where the source has hard edges or flat colour. |
| A photograph | Opens perfectly and is often five to ten times the size of the JPEG of the same picture. |
What it costs to write
Native, fast, and with no quality parameter to search — a browser gives you no control over the deflate level, so this bench encodes it once and measures what came out.
Where it goes wrong
- Photographic noise is incompressible to a lossless encoder. A grainy photograph in PNG is close to raw storage.
- A browser's PNG encoder takes no options, so the file it writes is larger than a dedicated optimiser would produce from the same pixels.
- 16-bit PNGs are reduced to 8 bits per channel when a browser decodes them, and the extra depth is gone from anything written afterwards.
- Interlaced PNGs decode fine and are larger than the same picture stored normally.
When this is the right answer
Anything drawn: a screenshot, a chart, a user interface, a logo, line art, a diagram. Anything with hard edges between flat areas of colour, where a lossy encoder would spend bytes producing artefacts. Anything that needs real transparency and has to be readable by software of any age. And any file that is going to be opened and edited again, where each round trip through a lossy encoder would take another bite.
It is the wrong answer for a photograph, and the bench will usually show you by how much.
Questions about PNG
- Why is my PNG larger than the JPEG of the same picture?
- Because it is storing every pixel exactly and the JPEG is not. On a photograph the difference is routinely five to ten times, and none of that is a defect: it is the price of the guarantee.
- Can a PNG be made smaller without losing anything?
- Yes, by reducing the palette when the picture genuinely has few colours, or by running a dedicated optimiser that tries more prediction filters than a browser will. A browser's own encoder takes no options at all, so what this bench reports is what a browser can produce, not the floor for the format.
- Does PNG support animation?
- APNG does, and most browsers display it, but it is a separate thing from a still PNG and nothing here writes one. A file handed to this bench is read as a single frame.
- What happens to a 16-bit PNG here?
- It is reduced to 8 bits per channel when the browser decodes it, before this bench sees a pixel. Anything written afterwards is 8-bit. If the extra depth matters, keep the original and do that work in software that can hold it.
- Is lossless WebP better than PNG?
- Often smaller, for the same guarantee, on the sort of drawn picture where lossless makes sense. The reason to still choose PNG is that everything opens a PNG, and the reason to check is that the difference on your particular file is the only difference that matters.
Encoding happens on this machine; the file stays where it is.