If you are asking yourself should i compress png files, you have already run into the central tension: PNG is always compressed and always lossless, yet some files stay stubbornly huge. The real question is whether the file in front of you is a master or a delivery copy. Masters you never touch. Delivery copies you shrink aggressively. This article gives you the workflow that removes the tradeoff and warns you about the one mistake that ruins a file.
The answer changes depending on which file you hold. A master is the layered, editable original you keep for future work. A delivery copy is the flattened, resized version you send to a website. Compress everything you publish. Never compress masters or print originals. Print resolution is far higher than screen and exposes banding invisible on a monitor. Send print the untouched original. For everything on screen, ask yourself whether the tradeoff of palette reduction is worth the file size saving.
When to Compress Images
Compress an image when its destination is a screen. That is the short rule. If the image goes on a web page, an email, a presentation, or a social media post, it needs compression. If the image stays in your design document or goes to a printer, leave it alone.
Images typically make up 50 to 70 per cent of a web page's total weight. The Largest Contentful Paint is very often an image, so the hero image is usually the most effective thing to shrink. Declaring width and height on an image prevents the layout shift measured by Cumulative Layout Shift, but that does nothing for the byte count. You still need to compress.
The honest answer to is compressing png worth it is yes for every published image and no for every master. The savings are real. A UI screenshot can lose 70 to 85 per cent of its size with no visible change. A logo or icon drops 60 to 80 per cent. A chart or diagram sheds 70 to 80 per cent down to palette reduction. Even an illustration with gradients saves 40 to 65 per cent. Only an already optimised file gains nothing.
When Not to Compress
Do not compress photographs stored as PNG. A photograph in PNG is roughly ten times the size of the same photo as JPEG at a quality difference invisible at normal viewing distance. Change the format instead. JPEG has no alpha channel, so if transparency is needed, use WebP. Google's published figure for WebP lossless is about 26 per cent smaller than PNG, and all current browsers support it.
When Palette Reduction Hurts
Palette reduction cannot be undone. Keep the original and compress a copy. The visible failure mode is banding in smooth gradients, because a soft fade needs many closely spaced colours to look continuous. The second failure mode is a stair step fringe on semi transparent edges, worst on curves and diagonals. A gentler setting fixes it, but print will still expose the banding. That is why you never compress masters.
PNG Compression Best Practice
Best practice is a three step order that matches the way compression tools work. Strip metadata losslessly first. Then reduce the palette in steps if the image type allows it. Then change dimensions. Resize before compressing, because compressing pixels you are about to discard is wasted work and the compressor performs better on the smaller image.
Step One: Strip Metadata
Metadata chunks like tEXt, iTXt, eXIf, and ICC colour profiles can be stripped losslessly. The decoded pixels are identical. Tools like optipng and zopflipng do this automatically. So does ImageOptim on macOS. The saving is typically 5 to 15 per cent. Sometimes zero on an already optimised file. A correct tool returns the original if re encoding would produce a larger file.
Step Two: Reduce the Palette
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 happen. 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 savings are dramatic. A UI screenshot loses 70 to 85 per cent. A logo loses 60 to 80 per cent. A photograph stored as PNG loses 40 to 70 per cent.
Photoshop users: File > Export > Export As, tick the Smaller File (8 bit) checkbox. That switches to a 256 colour indexed palette. File > Export > Save for Web gives finer control with a Colors dropdown from 2 to 256, a Dither slider, and a live file size readout. GIMP users: Image > Mode > Indexed, choose Generate Optimum Palette, set the maximum number of colours, then Export As PNG. The Export As dialog has a Compression level slider from 0 to 9 that is entirely lossless. Level 9 is slower and slightly smaller. Do not use File > Save in GIMP, which writes the internal .xcf format.
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. Palette reduction is not.
Step Three: Change Dimensions
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 for full screen use. A blog image needs about 1600 pixels.
On macOS, Preview: Tools > Adjust Size changes pixel dimensions. That is the real saving available in Preview, because Preview has no PNG quality or compression slider. On Windows, Paint: Resize on the Home tab changes dimensions, and the Photos app has a Resize option with preset and custom dimensions. On Windows 11 a quality slider appears for JPEG output only, not for PNG.
What Lossless Optimisation Actually Does
Lossless optimisation searches harder for the best filter per row, re runs DEFLATE at maximum effort, and strips metadata chunks. The decoded pixels are identical. Typical saving is 5 to 15 per cent. Sometimes zero on an already optimised file. Re encoding can produce a larger file than the original, so a correct tool returns the original in that case.
PNG has two compression stages. First filtering: for each row the encoder picks one of five filter types (None, Sub, Up, Average, Paeth) that predicts each pixel from its neighbours and stores the difference. Then DEFLATE compresses the filtered bytes. Flat colour, sharp edges, and repeated patterns make the prediction correct, so the differences are mostly zero 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. That is why photos are huge as PNG.
How Palette Reduction Compounds
Palette reduction has two compounding effects. 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 savings are far larger than lossless alone. Typical savings measured by image type: UI screenshot 70 to 85 per cent. Logo, icon, or line art 60 to 80 per cent. Chart or diagram 70 to 80 per cent. Illustration with gradients 40 to 65 per cent. Photograph stored as PNG 40 to 70 per cent. Lossless only savings for the same types are 5 to 15 per cent, and 0 to 5 per cent for a photograph.
The visible failure mode is banding in smooth gradients, because a soft fade needs many closely spaced colours to look continuous. The second failure mode is a stair step fringe on semi transparent edges: the soft alpha band around a rounded logo needs enough palette entries or it snaps into discrete steps. Worst on curves and diagonals. A gentler setting fixes it.
Format Comparison at a Glance
| Format | Lossy or Lossless | Alpha Channel | Best Use |
|---|---|---|---|
| PNG 24/32 | Lossless | Yes | Graphics, screenshots, line art |
| PNG 8 | Lossy (palette) | Per entry in tRNS | Icons, logos, simple graphics |
| JPEG | Lossy | No | Photographs, complex gradients |
| WebP | Both | Yes | Modern web, replacement for both PNG and JPEG |
Keep a Lossless Master and Compress a Copy
Keep the master. Always. The master is the layered, editable file in the format of your design tool. Never touch it with a compressor. Make a flattened copy, resize it to the display dimensions you need, run lossless optimisation, then apply palette reduction if the image type allows. Export as PNG or WebP. The copy on your server is the compressed version. The master in your archive is untouched. That removes the tradeoff completely.
For a photograph stored as PNG, change the format. JPEG handles sharp edges badly, producing visible ringing around text and lines, and on flat artwork often produces a larger file than PNG. But for a photograph, JPEG is the correct choice. If you need transparency, use WebP. The honest answer for a photograph below about 100KB is downscaling, and below 50KB the honest answer is to change format.