CompressPictureA PictureEditor.com tool
Every re-encode happens on this device. No file is posted anywhere.

Compress a PNG

Two mechanisms, kept apart: a lossless re-deflate that changes no pixel, and a palette reduction that changes many. The dimensions stay as they are either way.

Drop up to 100 images. Nothing is re-encoded until you set a quality or a target size.Click, press Enter, or paste from the clipboard. 120 MB a file, JPG PNG WebP GIF BMP TIFF HEIC.

Nothing to hand?

PNG mechanism

Applies to any PNG you open. Not one pixel changes. The picture is encoded under more than one row filter and the shortest attempt wins — the step a browser's own PNG writer does not take.

Nothing is re-encoded until a file is open and this button is pressed.

Lossless means lossless here

PNG stores rows of pixels, each row optionally predicted from the row above or the pixel to the left, and the whole thing deflated. Two files can hold identical pixels and differ by half their size depending on which filter each row picked and how much effort the deflate stage spent.

A browser writing a PNG is optimising for speed: one filter strategy, one deflate pass, done. The lossless pass here encodes the whole picture more than once and keeps the shortest result — two of the five row filters on anything larger than roughly four hundred by three hundred pixels, and all five below that, which is where the encoder draws its own line between effort and a stalled tab. Be equally clear about the ceiling: the deflate underneath runs at zlib's balanced level, not its slowest, so a dedicated optimiser like oxipng or zopfli still has a few percent on this. On a file straight out of a screenshot tool or a canvas the saving is often substantial anyway. On a file that has already been through an optimiser it is nothing, and the ledger says so.

What palette reduction does to a photograph

The other mechanism is not lossless and does not pretend to be. Every pixel is remapped to the nearest colour in a palette of the size you allow, with dithering to hide the seams. A 24-bit image has room for about sixteen million colours; a 256-entry palette has room for 256.

  • Screenshots, UI captures, diagrams, logos and line art: usually indistinguishable at 64 to 128 colours, and much smaller. This is the case PNG was built for.
  • Gradients, glows and soft shadows: banding appears as the palette shrinks, and dithering trades it for visible noise.
  • Photographs: a palette is the wrong tool. If the picture is a photograph, a JPEG at a sensible quality will be smaller and look better than any palette size that keeps it recognisable.

Bit depth, and the 16-bit case

A 16-bit-per-channel PNG carries more precision than a screen can show and more than this page keeps: it is decoded to 8 bits per channel on the way in, and what leaves is 8-bit. For anything headed for a screen or an upload form that is invisible. For a scientific or a print master it is a real loss, and the right answer is not to run that file through a browser at all.

Interlacing, animation and 16-bit precision do not survive.

An interlaced PNG comes out non-interlaced, an APNG loses every frame but the first, and 16-bit channels come out at 8. Each of those is a decision made by the decode-and-re-encode route this page takes, and none of them can be switched off here.

Questions people arrive with

Is the lossless pass really lossless?
Yes, and it is worth being precise about what that means: every pixel in the output is bit-for-bit identical to the pixel in the input. Only the encoding changes — which row filter the scanlines are predicted with, and how well the deflate stage behind it packs the result. If the output is smaller, it is smaller because the original was written by something in a hurry.
Why does my screenshot shrink so much and my photograph barely at all?
A screenshot is mostly flat colour and repeated rows, which deflate compresses well and a palette reduces to a few dozen entries with no visible change. A photograph has a different colour in nearly every pixel, so there is little repetition to find and a palette has to throw most of those colours away. PNG was designed for the first kind of picture.
How many colours should I allow?
For a screenshot, a diagram or a logo, 64 is usually indistinguishable from the original and often a quarter of the size. For anything with a gradient in it, expect visible banding below about 128, and expect a photograph to look wrong at any palette size. The comparison at 400 percent is the way to decide, because it depends entirely on the picture.
Will transparency survive?
Yes. A PNG with an alpha channel stays a PNG here and keeps its transparency, and the palette pass keeps alpha per palette entry. Nothing is flattened onto a background colour without being asked, because this page never converts a transparent picture into a format that has no alpha channel.
My PNG came back bigger. Why?
It was already optimised — most likely by a tool that does exactly what the lossless pass here does. When there is nothing left to find, a re-encode costs a few bytes of overhead rather than saving any. The row is marked no gain, left out of the download, and you are told to keep what you have.

Elsewhere on this site