PNG Compressor

Published Updated

Re-encode a PNG at 100%, 75%, 50% or 25% of its width and height, with transparency kept.

Which path a picture takes

The tool first reads your PNG's pixels. If at least one pixel is partly transparent (an alpha value between 0 and 255), it decodes the picture to raw RGBA, scales it with its own alpha-weighted resizer if you chose a smaller size, and writes it with a lossless PNG writer; no canvas is involved. Every other picture is redrawn on a canvas and saved by the browser, because a canvas appears to store colors weighted by alpha and so to change only partly transparent pixels (our measurements of canvas output are consistent with that), and the browser's writer compressed our noisy test image better. Animated PNGs, pictures above 25 million pixels and files the pixel reader cannot open also use the canvas.

We made four PNG files with Pillow 11.3.0, all synthetic: a flat 800 x 800 logo saved as an indexed PNG, a 1200 x 800 gradient with noise, a 400 x 300 sticker with a soft semi-transparent edge, and a 1280 x 720 flat-color interface mock-up saved as 24-bit. We ran the tool's own decision, re-encode code and keep-the-original check in Chromium 153.0.8010.12 (the build that ships with Playwright, headless, not Google Chrome), Firefox 155.0 and Playwright's WebKit build (user agent Version/26.6, not the Safari app). The table shows Chromium 153. An asterisk marks a result that is larger than the original, which the tool replaces with your original file.

Image (original size)Path100%75%50%25%
800 x 800 indexed logo (3,603 B)Canvas20,347 B*18,521 B*9,023 B*4,449 B*
1200 x 800 gradient with noise (1,436,200 B)Canvas1,774,159 B*1,055,598 B472,943 B111,525 B
400 x 300 sticker with soft edge (24,380 B)Raw RGBA23,393 B21,613 B11,002 B4,661 B
1280 x 720 flat-color interface (5,640 B)Canvas22,665 B*16,330 B*8,433 B*3,921 B

At 100% the sticker came out 4% smaller. The other three came out larger than their originals, so for those the tool hands back your original; in Chromium 153 the gradient saved space at 75% and below, the interface image only at 25%, and the logo at no scale. The browser writes the canvas path, so its sizes differ by engine: the gradient at 100% was 1,774,159 bytes in Chromium 153, 1,476,267 in Firefox 155 and 1,527,259 in WebKit 26.6. The sticker, which takes the raw path, was 23,393 bytes at 100% in all three.

Why 100% only rewrites the file

A PNG can store a palette of up to 256 colors, which is why flat artwork is often tiny. This tool writes full RGBA, so a file optimized by a dedicated tool can end up larger, and then you get your original back. The PNG format itself is defined in the W3C PNG specification.

Scaling down is the main lever, so the tool works as a resizer that outputs PNG. If you hope for the same dimensions in far fewer bytes, an optimizer such as pngquant or oxipng on your computer is the better route.

Which pixels survive

We decoded each 100% output with Pillow and compared it with the source. For all four images, including the sticker with 39,629 semi-transparent pixels, 0 pixels differed in all three engines, and the largest difference in any channel was 0. Pixels that were fully transparent in both files were skipped, because their hidden color values do not show.

Compressing a PNG

  1. Step 1

    Add a PNG

    Pick one PNG file. Its pixel size and file size are shown.

  2. Step 2

    Choose 100%, 75%, 50% or 25%

    This is the scale of width and height. 100% keeps the pixel size and re-encodes the pixels (in our test of four generated images they came back identical).

  3. Step 3

    Compress, compare, download

    The result card shows the new size and a Saved percentage. If the new file would not be smaller than yours, it says re-encoding did not make the PNG smaller and offers your original.

Alternatives without leaving the site

Pick the route by what you can change:

PNG Compressor FAQ

What happens if compressing would make my PNG bigger?

The page re-encodes your picture, scaled if you chose a smaller size. A PNG that was already squeezed by a dedicated tool can come out larger. When the new file is not smaller than yours, the tool says re-encoding did not make the PNG smaller and offers your original, unchanged and with its own file name.

Does it reduce the number of colors?

There is no quantization and no quality slider. A 16-bit PNG is written with 8 bits per channel, so its finer steps are lost. Beyond that, the only way the size drops below what lossless rewriting saves is by using fewer pixels.

Does 75% mean 75% of the file size?

No, it means 75% of the width and of the height, which is 56% of the pixels. File size usually falls faster than the percentage, as the table shows for the photo-like image.

Is transparency kept?

Yes. A picture with soft, semi-transparent edges is read and written as raw RGBA, so in our test of one generated sticker its alpha channel and colors came back unchanged at 100%; when you scale down, colors are averaged weighted by alpha so transparent areas do not darken the edges. A picture whose pixels are all either opaque or fully transparent is redrawn on a canvas, which keeps that transparency unchanged at 100%.

What should I use to shrink a PNG without changing its dimensions?

A tool built for it: pngquant reduces the palette, and oxipng recompresses losslessly with more effort than this page. On this site, converting to WebP or JPEG is the browser-based route when the format may change.

Is metadata removed?

Yes. The file is rebuilt from pixels, so text chunks, color profiles and other metadata are not copied into the new PNG.

Does the compressed PNG look identical to my original?

At 100% the pixels of four generated test images were the same. We decoded the outputs with Pillow 11.3.0 and compared them with the sources: 0 of the pixels differed in four generated images, including a sticker with 39,629 semi-transparent edge pixels, in Chromium 153, Firefox 155 and WebKit. A canvas appears to change only partly transparent pixels, which is why those pictures skip it. At 75%, 50% and 25% the picture is resampled, so pixels change by design.

Why did I get a different size in another browser?

For pictures without semi-transparent pixels the PNG is written by the browser, so sizes differ. The same 1200 x 800 gradient at 100% came out at 1,774,159 bytes in Chromium 153, 1,476,267 in Firefox 155 and 1,527,259 in WebKit. Pictures with semi-transparent pixels are written by code on this page and gave the same bytes in all three.

Related Tools