Skip to content

How to compress PNG files (and when PNG is the wrong format)

Lossless optimisation, smart palette reduction and transparency: how to make PNGs smaller, and why a photo usually should not be a PNG at all.

Compression · 2 min read · Updated

Ready to try it? Open Compress PNG. It runs in your browser, with no upload.Open tool

Why PNGs get big

PNG is lossless: it stores every pixel exactly, using a filtering step and DEFLATE compression, the same family of compression used in ZIP files. That works very well for screenshots, logos and flat graphics, which contain long runs of identical colours. It works badly for photographs, where almost every pixel differs from its neighbours. A photo saved as PNG is often 3 to 10 times larger than the same photo as a good JPG.

Two kinds of PNG compression

Compress PNG offers both, and it is worth knowing which one you are using:

  • Lossless only: OxiPNG tries different filters and compression settings and keeps the smallest result. Every pixel stays identical. Savings vary, and are largest for files exported without any optimisation.
  • Smart palette (lossy): the image is reduced to at most 256 carefully chosen colours, with optional dithering to smooth gradients, then optimised. Screenshots and graphics often shrink by 60 to 80 percent with no visible change, but subtle gradients and photos can show banding.

Transparency is kept

Both modes keep the alpha channel, including soft, anti-aliased edges. In palette mode each colour carries its own transparency, which handles most edges well, but very soft shadows over many colours can show slight stepping. Compare before and after on the checkerboard background before you replace the original.

When to change format instead

  • Photos: convert to JPG or WebP. The file usually becomes a fraction of the size.
  • Photos or cut-outs with transparency: WebP and AVIF keep the alpha channel at a far smaller size than PNG.
  • Graphics for a website: lossless WebP is usually smaller than an optimised PNG, and every current browser supports it.
  • Logos and icons that started as vector artwork: an SVG may be smaller still and stays sharp at any size.

Limitations

  • Lossless optimisation cannot shrink a PNG that was already well optimised. The tool then returns your original and says so.
  • Palette reduction is lossy. Keep the original if you may need to edit the image later.
  • Converting PNG to JPG removes transparency. Transparent areas are filled with a background colour you choose, white by default.

Tools in this guide

All guides