To compress a PNG you have two distinct levers: lossless optimisation and palette reduction. One preserves every pixel exactly. The other discards colour information in a way the eye barely notices. Each delivers a very different saving. This page explains what each mechanism does, how much space it actually saves, and which one your image needs right now.

A PNG is always compressed and always lossless. There is no uncompressed PNG. The format uses two stages: filtering and DEFLATE. Filtering predicts each pixel from its neighbours and stores the difference. Flat colour and sharp edges produce small differences that compress to almost nothing. Photographic sensor noise makes the prediction wrong nearly every time, giving random differences that are close to incompressible. That is the whole reason photos are huge as PNG.

JPEG discards high-frequency detail the eye is poor at noticing before compressing. PNG promises exact pixels, so it can never do that. Sending a photograph away to JPEG before you even think about PNG compression is the single most effective move you can make. An image stored as PNG is roughly ten times the size of the same photo as JPEG at a quality difference invisible at normal viewing distance. JPEG has no alpha channel. Converting a transparent PNG to JPEG flattens transparency onto a solid colour, usually white. JPEG handles sharp edges badly, producing visible ringing around text and lines. On flat artwork JPEG often produces a larger file than PNG. WebP supports a full alpha channel like PNG. Google's published figure for WebP lossless is about 26 per cent smaller than PNG. WebP is supported by all current browsers. Some older desktop applications still cannot open it.

Lossless Optimisation: What it Really Saves

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. A correct tool returns the original in that case.

Metadata Stripping

Metadata chunks (tEXt, iTXt, eXIf, iCCP colour profiles) can be stripped losslessly. Removing them costs nothing in quality and always reduces file size by at least a few kilobytes.

Lossless PNG Compressors

optipng and zopflipng do lossless optimisation. ImageOptim on macOS bundles several lossless optimisers. GIMP's Export As dialog has a Compression level slider from 0 to 9. It is entirely lossless. Level 9 is slower and slightly smaller. It does not reduce colours. The dialog also has checkboxes to save or omit background colour, gamma, layer offsets, resolution, creation time and comments. Unchecking these strips metadata.

Lossless optimisation is safe to repeat. Run it on every PNG you ship. It will never damage the image. It will sometimes do nothing. That is fine.

Palette Reduction: the Real Saving

Palette reduction, also called indexed mode, is what pngquant and TinyPNG do. It 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. Thousands of near-identical shades collapse into one entry, creating exactly the repetition DEFLATE feeds on.

Savings vary by image type. A UI screenshot sees 70 to 85 per cent reduction. A logo or icon 60 to 80 per cent. A chart or diagram 70 to 80 per cent. An illustration with gradients 40 to 65 per cent. A photograph stored as PNG 40 to 70 per cent. An already optimised PNG sees zero 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. 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.

Palette reduction cannot be undone. Keep the original 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.

Reduce the PNG Palette to Cut File Size

In Photoshop, File > Export > Export As, choose PNG. The panel has a Smaller File (8-bit) checkbox which switches to a 256 colour indexed palette. File > Export > Save for Web (Legacy) gives finer control: PNG-8 with a Colors dropdown (2 to 256), a Dither slider, and a live file size readout. In GIMP, Image > Mode > Indexed, choose Generate optimum palette and set maximum number of colours, then export. pngquant does palette reduction on the command line.

How to Compress PNG File Size

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 2560px on the long edge covers full screen use. A blog image needs about 1600px.

Resize before compressing. Compressing pixels you are about to discard is wasted work and the compressor performs better on the smaller image. If you have a photograph stored as PNG, targets below about 100KB mean downscaling. Below 50KB the honest answer is to change format.

The cheapest order is: strip metadata losslessly, then reduce the palette in steps, then reduce dimensions, then change format. Realistic outcomes for a screenshot or graphic: 500KB easy with no visible change, 200KB easy on most images, 100KB achievable and may need slight downscaling, 50KB needs downscaling on large images, 25KB only for small or simple images.

On macOS, Preview has no PNG quality or compression slider. The real saving available in Preview is Tools > Adjust Size which changes pixel dimensions. Preview can export to JPEG, where a Quality slider does appear. On Windows, Paint has no compression setting. It can save as JPEG, which is the large saving available for photographs. The Photos app on Windows 11 has a quality slider for JPEG output, not for PNG.

Now you know how to compress a png file. You reduce the dimensions first, then apply palette reduction. That is the answer to how do i compress a png file. And if the image is a photograph, the answer to how to compress an image png is: do not. Send it to JPEG instead.

How to Compress PNG Images

This question about how to compress png images usually means a batch of files. The principles are the same for one image or a hundred. Palette reduction gives the largest saving. Lossless optimisation adds a smaller but free gain on top. Resizing before either step multiplies the effect.

For a folder of screenshots, run pngquant with a palette of 256 colours. Then run optipng on the output. That pair will drop the total weight by 70 to 85 per cent with no visible change in most cases. For icons and logos, drop the palette to 128 or even 64 colours. The savings are still large and the loss is invisible on a solid colour shape.

Images are typically 50 to 70 per cent of a web page's total weight. Largest Contentful Paint is very often an image. 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. Print resolution is far higher than screen and exposes banding invisible on a monitor. Send print the untouched original.

Palette reduction steps are discrete. A result often lands well under the requested ceiling rather than exactly on it. That is normal. Settings move in steps of powers of two: 256, 128, 64, 32. Pick the highest that still looks clean on a real screen. Do not zoom in. Do not pixel peep. Judge at normal viewing distance.

Which Method Should You Pick

If the image is a photograph, do not use PNG. Export as JPEG at quality 85. The file will be roughly one tenth the size. If you need transparency, use WebP. If you cannot use WebP and must keep PNG, palette reduction still cuts a photo by 40 to 70 per cent. The banding will be visible in smooth skies and skin tones. Accept that or change format.

If the image is a screenshot, icon, logo, chart or diagram, use palette reduction to 256 colours. Run lossless optimisation after it. That is the definitive workflow. If the image is an already optimised PNG, palette reduction will do nothing. Run lossless optimisation to see if there is any metadata to strip.

If the image has smooth gradients or semi transparent edges, test the palette reduction at 256 colours. Zoom to the gradient. If you see banding, try 128 colours with dither. If that still shows steps, keep the original truecolour PNG and rely on lossless optimisation alone. The saving will be 5 to 15 per cent. That is the price of preserving a smooth fade.

Oversized images need resizing first. An image stored at 3000 pixels wide for a blog post that displays at 800 pixels needs to be scaled to about 1600 pixels. That step alone cuts the file by roughly 75 per cent before any compression technique touches it. Do not skip it.