Compress a PNG Without Losing Transparency
Keeping the see-through parts see-through, and keeping the edges clean.
What This Guide Covers
Almost everything about PNG compression is decided by two things: how many colours the image uses, and how it stores transparency. This page is about the second one. It covers logos, icons, UI elements and product images on a cut-out background, which are the files most likely to come out wrong.
If you want the format itself, the filters and the chunk layout, read How PNG Compression Works. For the wider workflow, including resizing and metadata, read the PNG Optimization Best Practices.
The Short Answer
Compress a PNG in lossless mode and transparency survives exactly. The risk is not the compression itself. It is the palette step: when an image is reduced to a palette, a soft edge that used to fade out can turn into a hard jagged line.
Two Ways PNG Stores Transparency
| Storage | What it means | Best for |
|---|---|---|
| Full alpha channel | Every pixel carries its own opacity value, so an edge can fade gradually | Real alpha images, soft shadows, anti-aliased logos |
| Palette transparency | One palette entry is marked as see-through, everything else is solid | Flat graphics and pixel art with hard edges |
A PNG palette holds up to 256 entries. That is a hard limit of the format, and it is the reason the palette step is risky for a logo with a soft edge: the edge needs many partially transparent values, and 256 entries may not be enough.
What Goes Wrong at the Edges
A logo designed on a white page usually has a soft outline where the shape meets the background. Each of those outline pixels holds part colour and part transparency. Reduce the palette and some of those values have to be rounded, so the outline becomes a stepped line or picks up a faint white fringe.
The fix depends on where the image will sit. If it always lands on the same background colour, flatten it onto that colour and save as a normal image with no transparency. If it has to work on light and dark pages, keep full alpha, which costs more bytes but cannot fringe.
Safe Ways to Make the File Smaller
- Compress in lossless mode. The pixel data comes back identical, so every transparency value survives.
- Remove metadata. Colour profiles, text chunks and timing data add bytes that have nothing to do with the picture.
- Crop to the visible content, so the transparent margin is not stored at all.
- Resize to the size it is actually shown at. A 2000 pixel logo shown at 200 pixels is mostly wasted bytes.
When a Palette Is Still Fine
A palette is safe when the image already uses few colours and its edges are hard: pixel art, simple flat icons, diagrams with solid lines. The test is to look at the edge at 200 percent on both a light and a dark background. If the outline stays clean, the palette did no harm.
Check the Result Before You Keep It
Run the file through the PNG size optimizer and compare the result. Open the compare view, zoom to at least 100 percent, and look at the same edge twice: once over a white area and once over a dark one. A fringe that is invisible on one background often shows on the other.
No fixed size figures are given here, because the result depends on the image. The tool shows the before and after size of your own file, and that is the number to judge.
Next Steps
Ready to try it on your own file? Open the free PNG compressor. To understand what the compressor is actually doing to your bytes, read How PNG Compression Works. If you have many files to process, the batch compression guide covers how to organise the work.