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?
Can a PNG be made smaller without losing anything?
Does PNG support animation?
What happens to a 16-bit PNG here?
Is lossless WebP better than PNG?
Encoding happens on this machine; the file stays where it is.