Image Compressor
Re-encode a PNG losslessly at a chosen compression level, optionally downscaling to a maximum width, and see the size change.
What the Image Compressor does
The page decodes the PNG's own scanlines — greyscale, truecolour, palette and truecolour-with-alpha at 8 bits — re-encodes them at the chosen DEFLATE level, and writes a fresh PNG with recomputed checksums.
A Maximum width above 0 downscales first, by nearest neighbour, which is exact arithmetic: each output pixel is a copy of a source pixel, so no colour is invented.
PNG only, 8-bit and not interlaced: a JPEG, a 16-bit or an Adam7 PNG is refused by name rather than half-converted. Downscaling by nearest neighbour keeps detail crisp but does not smooth edges the way a resampling filter would, and it is a size tool, not a beauty filter.
How to use it
Choose the PNG image from the PNG image picker.
Set Compression level (1-9) — 9 is the most effort and the smallest file — and Maximum width (px, 0 keeps it) if you also want the picture smaller, or leave it at 0 to keep the dimensions.
Press Run, look at the Compressed PNG preview, and compare its size in the status line with the size of the file you loaded. Download saves the new PNG.
Worked example
Input:
(image/png fixture, about 9333 bytes)
Output:
(a PNG image, shown as a preview and saved by Download)
Why it runs in your browser
The result is produced on this page with JavaScript, so it works offline after the page loads and nothing you enter is sent anywhere.
A smaller PNG with the same pixels: the image is decoded, re-encoded at the compression level you choose, and written back as a PNG.
PNG is lossless, so "quality" here is compression effort, not a visual setting. Nothing is thrown away except the bytes the encoder did not need.
What it does, and what it does not
The page decodes the PNG's own scanlines — greyscale, truecolour, palette and truecolour-with-alpha at 8 bits — re-encodes them at the chosen DEFLATE level, and writes a fresh PNG with recomputed checksums.
A Maximum width above 0 downscales first, by nearest neighbour, which is exact arithmetic: each output pixel is a copy of a source pixel, so no colour is invented.
PNG only, 8-bit and not interlaced: a JPEG, a 16-bit or an Adam7 PNG is refused by name rather than half-converted. Downscaling by nearest neighbour keeps detail crisp but does not smooth edges the way a resampling filter would, and it is a size tool, not a beauty filter.
How to use Image Compressor
Choose the PNG image from the PNG image picker.
Set Compression level (1-9) — 9 is the most effort and the smallest file — and Maximum width (px, 0 keeps it) if you also want the picture smaller, or leave it at 0 to keep the dimensions.
Press Run, look at the Compressed PNG preview, and compare its size in the status line with the size of the file you loaded. Download saves the new PNG.
What to Expect
Best for
- Shrinking a screenshot before uploading it
- Cutting an image's width down to what a page needs
- Re-saving a PNG that a tool wrote lazily
Not ideal for
- Photographs, where JPEG at a quality setting is far smaller
- 16-bit or interlaced PNGs, which are refused
- Smoothing a downscale, which this page does not do
What this tool keeps
- Every pixel, exactly, when only the level changes
- The aspect ratio when you downscale
- The transparency of an alpha PNG
What may need cleanup
- Re-save a 16-bit PNG as 8-bit first
- Use a JPEG tool for photographs
Common errors
- The page refuses it: PNG only
Example use cases
- Compressing screenshots for documentation
- Preparing images for a page's fixed width
- Re-saving an exported PNG
Sample input
PNG image: (image/png fixture, about 9333 bytes)
Sample output
Compressed PNG: (a PNG image, shown as a preview and saved by Download)
Who this is for
- Anyone shipping images on the web
- Developers reducing an asset's size
Frequently asked questions
Is this lossy?
No. PNG is a lossless format and the page only changes how the pixels are compressed, not the pixels themselves. The test decodes the output and compares it to the input, pixel for pixel.
Why does level 9 sometimes change nothing?
An image that is already well compressed has little left to gain. The re-encode never makes it larger than the stored form, and the status line reports the size you got rather than promising a percentage.
What does Maximum width do to the height?
It scales the height by the same ratio and rounds to a whole pixel, so the aspect ratio is preserved. Setting 0 means no scaling at all.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.