CompressPictureCompress an image

Compress a PNGLighter PNGs with the same crisp pixels

Shrink screenshots and graphics — keep every pixel, or trade a few colours for a much smaller file.

A photographer sliding landscape prints into a paper envelope on a wooden desk — the compressed copy, which looks the same as the original.Looks the same
studio-prints.jpg261 KB261 KB down to 136 KB−48%
Same photo, same 1800 × 720 size
or drop it here · paste works tooJPG, PNG, WebP, GIF or HEIC · up to 120 MB

No photo handy?

Free · No sign-up · Photos stay on your device

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.

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 works in two stages. The in-page encoder writes the picture under more than one row filter and keeps the shortest; then OxiPNG — the desktop optimiser, built for the browser and fetched from this site the first time it is needed — searches the filters and deflate settings harder still, and the smaller of the two files is kept. Effort (Fast, Balanced, Thorough) sets how hard OxiPNG looks. On a file straight out of a screenshot tool or a canvas the saving is often substantial. On a file that has already been through an optimiser it is close to nothing, and the result 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