How do you compress a PNG if PNG is lossless?
PNG compresses pixels with DEFLATE, the same algorithm as ZIP files, and never throws anything away. A full-color PNG stores each pixel as 3 bytes of color, plus 1 byte of transparency when it has an alpha channel, which allows millions of colors even when the image uses a few dozen. Making the file smaller without touching the format therefore means storing fewer colors.
That is what palette quantization does: it picks the up to 256 colors that best represent the image and stores each pixel as a single index into that palette. Indexed PNG has been part of the PNG standard since the start, so the result opens everywhere a PNG opens. The step is lossy, but on logos, icons, diagrams and most screenshots the difference cannot be seen. If you are wondering why a simple graphic weighs megabytes in the first place, read why is my PNG file so large.
Which images compress well as PNG?
How each kind of image reacts to a 256-color palette, and the better move when it does not.
| Image | Palette PNG result | Best move |
|---|---|---|
| Logo, icon, flat illustration | Usually no visible change | Compress PNG at 80 |
| Diagram, chart, line art | No visible change | Compress PNG at 80 |
| Screenshot of an app, site or document | Text stays sharp; soft gradients may band slightly | Compress PNG at 80, or 95+ if banding shows |
| Product cut-out on a transparent background | Soft shadows and edges may band | Convert to WebP: transparency with smooth tones |
| Photo saved as PNG | Visible banding in skies and skin | Compress as JPG or convert to WebP |
| Pixel art, exact brand colors | Colors may shift slightly | Quality 95+ (lossless) |
Does compressing a PNG keep transparency?
Yes. A palette PNG can store a transparency level for each of its colors, so fully transparent areas stay transparent and semi-transparent edges keep their blend. The hardest case is a soft drop shadow, which mixes many colors with many transparency levels: if you see a halo or steps in the shadow, raise quality to 95 or above, or use WebP, which keeps transparency with smooth gradients (PNG to WebP).
Why is my PNG still large after compressing?
- It is a photo. Photos have noise and millions of subtly different colors, which PNG stores badly even with a palette. Compress it as a JPG or convert it to WebP.
- It has huge dimensions. Screenshots from a Retina or high-DPI screen are twice as wide as they appear. Limiting a 2880 px screenshot to 1440 px removes three quarters of the pixels.
- It was already optimized. A PNG that went through pngquant or a similar tool has little left to remove, so the tool keeps the original.
Should you convert PNG to WebP or JPG instead?
If the image goes on your own website, WebP is usually the better target: it can be lossy and transparent at the same time, which no PNG can. Google measures lossless WebP at about 26% smaller than PNG, and lossy WebP is far smaller again on photographic content. Use PNG to WebP, and see WebP vs PNG for the trade-offs. Keep PNG where it is required (some app stores, design handoffs, print workflows) and where exact pixels matter, and use a JPG target page when a form asks for a JPG under a set size.