LeanImg

Compress a PNG Image

A PNG never loses a pixel to its own encoder, which turns compressing one into an honest fork in the road: keep the image mathematically identical and take a modest saving, or let a palette stage discard colour information first and shrink the file dramatically. This page offers both routes, runs them entirely in your browser, and preserves transparency either way. The table shows what each route did to the same transparent test image — measured results, not estimates.

Loading compressor...

The same PNG, both routes

ModeOutputSaving
PNG, no compression (lossless)383.9 KB59% smaller
PNG, smaller file size (quantized)98.3 KB90% smaller
LeanImg compressor showing alpha.png reduced from 942.4 KB to 98.3 KB, a 90% saving
The quantized route on a 900x606 transparent PNG: 942.4 KB down to 98.3 KB.

Two routes to a smaller PNG

The lossless route re-encodes your image, then hands it to oxipng, a Rust-based optimizer running at level 3, which searches for a more efficient arrangement of exactly the same pixels: different scanline filters, different deflate strategies, identical picture. On the 942.4 KB test file that search alone returned 383.9 KB. Nothing about the image changed; only the packing did.

The quantized route is where the dramatic numbers come from. Before the encoder runs, imagequant builds a palette of at most 256 colours and maps every pixel onto its closest entry. The output is still a perfectly ordinary PNG that any software opens — the information was given up before encoding rather than during it. The same test file landed at 98.3 KB this way, roughly a tenth of its starting weight.

Which route fits which image

Interface screenshots, logos, icons, pixel art and flat illustrations are what palettes were invented for. Such images rarely contain more than a few hundred distinct colours in the first place, so mapping them through 256 changes little or nothing the eye can find, and the saving is enormous. For anything of that kind headed to a web page, quantized is the sensible choice.

Reserve the untouched route for images where the pixels themselves are the point: a design master you will open again, archival material, or anything carrying long soft gradients. A sunset sky asks 256 palette entries to describe thousands of gentle colour steps, and the visible failure is banding — smooth ramps turning into contour lines. That is the one artefact worth checking for after quantization: edges will be crisp, ramps give it away first.

Transparency, and when to leave PNG behind

Both routes carry the alpha channel through intact, including partial transparency: the quantizer treats opacity as part of each palette entry, so the soft anti-aliased rim around a cut-out logo survives instead of collapsing into a hard fringe. What does destroy transparency is moving to a format without it — convert the result to JPEG and every see-through pixel is flattened onto a solid background, because no JPEG variant carries alpha.

Sometimes the best compression is leaving PNG entirely. A photograph stored as .png is a category mistake: the lossless guarantee costs megabytes on camera images and buys nothing a viewer can see, and converting such a file to JPEG or WebP typically shrinks it severalfold. For flat graphics that must stay small and transparent, lossless WebP also undercuts PNG on size — the trade being that a handful of older desktop programs still handle PNG more gracefully.

Frequently Asked Questions

Is PNG compression always lossless?

The format's own encoder is — the specification contains no lossy mode at all. Tools advertising dramatic PNG savings, this one included, get them by cutting the colour count before encoding begins. Choose the option labelled PNG — No compression here and nothing lossy happens at any stage.

What is the difference between the two PNG options in the dropdown?

PNG — No compression is the lossless path: identical pixels, repacked more cleverly. PNG — Smaller file size is the quantized path: a palette of up to 256 colours, then the same repacking. The names describe what happens to your image, not how hard the encoder works.

How much smaller can quantization make a PNG?

The transparent test image on this page dropped from 942.4 KB to 98.3 KB, and that order of saving is normal for screenshots and flat artwork. Files that already use a palette have far less to give, because the colour reduction has effectively been done once.

Will a quantized PNG look worse?

On flat-colour images, almost never — side by side, most people cannot pick the original. Gradients, vignettes and photographs are the exception: too few palette entries to describe a smooth ramp produces visible steps of colour.

Does a transparent background survive compression?

Yes, on both routes, and semi-transparent pixels such as drop shadows and smoothed edges survive too. Alpha is only lost by converting to a format that has none.

Why did my PNG barely shrink, or even grow?

Something already optimized it. Export pipelines increasingly run their own PNG optimizer, and a file sitting near its lossless floor leaves a second pass nothing to find — occasionally the attempt even costs bytes, in which case this tool hands back your original file unchanged.

Why is my PNG so large in the first place?

Usually resolution. A full-screen capture of a 4K or Retina display is eight or more megapixels of losslessly stored data before you have done anything. Quantization helps; cropping to the region that matters, or scaling interface captures to the size they will be shown at, helps more.

Can I compress several PNGs at once?

Ten files and up to 50 MB in one round, with a ZIP download for the results. Encoding happens in your browser rather than on a server, so there is no queue and no quota — run as many rounds as you need.

Other compression guides

Compress Images Online — Free Image Compressor