If you want to know how to compress png without losing quality, you first need to accept a hard limit: PNG is always compressed and always lossless, so there is no such thing as an uncompressed PNG. The algorithm works in two stages. First it filters each row of pixels by predicting each pixel from its neighbours and storing only the difference. Then DEFLATE, the same algorithm ZIP uses, compresses those filtered bytes. Flat colour, sharp edges and repeated patterns make the prediction correct, so the differences are mostly zeros and zeros compress to almost nothing. Photographic sensor noise makes the prediction wrong nearly every time, giving small random differences that are close to incompressible. This is the whole reason photos are huge as PNG.
The question this article answers is: can I make a PNG smaller with no quality loss at all, and what does that cost me? The short answer is yes, but only up to about 15 percent. That is the ceiling for strict lossless optimisation. The practical answer is that palette reduction, which is technically lossy, is invisible on the images most people actually have. Screenshots, logos, charts and icons all benefit. The two places palette reduction does show are banding in smooth gradients and stair step fringes on semi transparent edges.
Lossless PNG Compression: What it Actually Does
Lossless PNG compression means the decoded pixels are identical to the original. Every bit matches. An optimiser that claims lossless must guarantee bit for bit restoration. The research says typical savings range from 5 to 15 percent. Sometimes zero on an already optimised file. Re encoding can produce a larger file than the original; a correct tool returns the original in that case.
What the Optimiser Changes
The optimiser searches harder for the best filter per row, reruns DEFLATE at maximum effort, and strips metadata chunks. Metadata chunks include tEXt, iTXt, eXIf and iCCP colour profiles. Stripping them is always safe. The optimiser never changes a pixel. That is the strict meaning of lossless.
Lossless PNG Compression Ceiling
Fifteen percent is the practical ceiling because the algorithm cannot invent patterns that are not there. A photograph stored as PNG loses 0 to 5 percent with lossless methods. Photographic sensor noise destroys the prediction step. The compressor sees random differences and cannot compact them. If you need a smaller file than lossless gives you, you must accept some form of lossy compression or change the format.
To understand how to compress png files without losing quality within the lossless boundary, use optipng or zopflipng from the command line. On macOS, ImageOptim bundles several lossless optimisers. On Windows, no built in tool offers this; you need an online service or a command line tool. The result is a file that looks exactly like the original but loads faster.
When Lossy PNG Compression is Visible
Lossy PNG compression is visible in exactly two places. The first is banding in smooth gradients. A soft fade from dark blue to light blue needs many closely spaced colours to look continuous. When the palette drops from millions of colours to 256 or fewer, the gradient snaps into visible steps. This shows most on wide skies, product backgrounds and glossy reflections.
The second failure mode is a stair step fringe on semi transparent edges. The soft alpha band around a rounded logo or a drop shadow needs enough palette entries to stay smooth. At low colour counts the alpha transitions snap into discrete steps. The effect is worst on curves and diagonals. A gentler setting in the compressor fixes it. Tools like pngquant let you tune the colour count and dither to hide the transition.
Knowing when lossy PNG compression is visible helps you avoid it. If your image has wide gradients or soft alpha edges, test the output at full size on a high resolution screen before deploying. If it has flat colour, sharp edges and solid backgrounds, the lossy step is invisible and cuts 70 to 85 percent from a screenshot.
To decide how to compress a png file without losing quality for your specific image, ask whether it contains a smooth gradient or a soft edge. If it does not, palette reduction is safe. If it does, run the compressor at a gentler setting or stay lossless and accept the smaller saving.
Palette Reduction: the Real Savings
Palette reduction rebuilds the image from an adaptive palette of typically 256, 128 or 64 colours chosen from the colours actually present. Two compounding effects produce the saving. Each pixel needs 7 or 8 bits instead of 24 or 32, and thousands of near identical shades collapse into one entry, creating exactly the repetition DEFLATE feeds on. The typical savings by image type are dramatic. A UI screenshot drops 70 to 85 percent. A logo or icon drops 60 to 80 percent. A chart or diagram drops 70 to 80 percent. An illustration with gradients drops 40 to 65 percent. A photograph stored as PNG drops 40 to 70 percent. Lossless only savings for the same types are 5 to 15 percent, and 0 to 5 percent for a photograph.
Photoshop and GIMP
In Photoshop open File then Export then Export As. Tick the checkbox labelled Smaller File (8 bit). That switches to a 256 colour indexed palette. For finer control use File then Export then Save for Web (Legacy) and choose PNG 8. That gives a Colors dropdown from 2 to 256, a Dither slider and a live file size readout. In GIMP export as PNG then before exporting go to Image then Mode then Indexed. Choose Generate optimum palette and set a maximum number of colours. That is palette reduction.
Palette Reduction with Pngquant and TinyPNG
pngquant is a command line tool dedicated to palette reduction. TinyPNG is the same engine as a web service. Both produce files that look identical to the original on images that lack gradients and soft alpha. The output cannot be undone. Keep the original file and compress a copy. Compressing an already palette reduced file again gives a worse result than going to the low colour count once, because the second pass chooses from an already impoverished set. Lossless re compression is safe to repeat.
To learn how to compress png image without losing quality while still getting a large saving, use palette reduction on flat artwork and stay lossless on photographs and gradients.
Savings by Method and Image Type
| Image Type | Lossless Savings | Lossy Palette Savings |
|---|---|---|
| UI screenshot | 5-15% | 70-85% |
| Logo or icon | 5-15% | 60-80% |
| Chart or diagram | 5-15% | 70-80% |
| Illustration with gradients | 5-15% | 40-65% |
| Photograph stored as PNG | 0-5% | 40-70% |
Dimensions Matter More Than Compression
File size scales with pixel count. Doubling the width quadruples the data. An image displayed at 800 pixels wide and stored at 3000 carries roughly fourteen times the pixel data anyone will see. For high density screens serve about twice the display width. Roughly 2560 pixels on the long edge covers full screen use. A blog image needs about 1600 pixels. Resize before compressing. Compressing pixels you are about to discard is wasted work and the compressor performs better on the smaller image.
On macOS open Preview. Use Tools then Adjust Size to change pixel dimensions. This is the real saving available in Preview. On Windows open Paint. Use Resize on the Home tab or Ctrl+W. Save as PNG. Neither Preview nor Paint has any compression slider for PNG. The size reduction comes entirely from cutting dimensions. On Windows 11 the Photos app offers a quality slider for JPEG output only. PNG gets none.
Print resolution is far higher than screen and exposes banding invisible on a monitor. Send print the untouched original. Do not palette reduce for print work.
Format Change: When PNG is the Wrong Container
A photograph as PNG is roughly ten times the size of the same photo as JPEG at a quality difference invisible at normal viewing distance. JPEG discards high frequency detail the eye is poor at noticing. PNG promised exact pixels so it can never do that. If your image is a photograph, the honest answer is to change format. JPEG has no alpha channel. Converting a transparent PNG to JPEG flattens transparency onto a solid colour, usually white. WebP supports a full alpha channel and Google's published figure for WebP lossless is about 26 percent smaller than PNG. WebP is supported by all current browsers. Some older desktop applications still cannot open it.
JPEG handles sharp edges badly. It produces visible ringing around text and lines. On flat artwork JPEG often produces a larger file than PNG. For a screenshot or a logo, PNG with palette reduction is the right choice. For a photo, JPEG or WebP is the right choice. Do not use JPEG for an image that has text or hard edges.