Lossless means exactly lossless
Open a PNG, edit it, save it, and repeat a hundred times: the pixels that you did not touch come back bit-for-bit identical every time. PNG compresses by looking for patterns rather than by discarding information — each row of pixels is first transformed by a filter that predicts each pixel from its neighbours, and the resulting differences are then compressed with DEFLATE, the same algorithm behind ZIP.
That prediction step is why PNG is so effective on graphics and so mediocre on photographs. A flat blue background predicts perfectly and costs almost nothing to store. A field of grass predicts terribly, so almost every pixel has to be recorded in full.
Transparency done properly
PNG's alpha channel stores 256 levels of opacity per pixel, so edges can fade smoothly into whatever is behind them. This is the reason logos and UI assets are shipped as PNG: a GIF can only mark a pixel fully transparent or fully opaque, which leaves visible jagged fringing on curves and text.
One practical consequence: a PNG placed on a dark background will show a pale halo if it was originally composited against white. That is not a bug in the format — it means the semi-transparent edge pixels have white blended into them. Re-exporting from the source with the correct background is the only real fix.
PNG-8 versus PNG-24, and why your file is enormous
PNG has an indexed mode (commonly called PNG-8) that stores a palette of up to 256 colours instead of full RGB values. For icons, flat illustrations, and most screenshots this is visually identical to the full-colour version at a fraction of the size. Most export dialogs offer it, and most people never touch it.
If you are staring at a 6 MB PNG, the usual cause is that a photograph was saved as PNG. Lossless compression on photographic noise barely helps — you are storing essentially every pixel. That file will typically become a 400 KB JPEG or a 250 KB WebP with no visible difference. PNG is for graphics; JPEG, WebP, and AVIF are for photographs.
Converting PNG files
Converting PNG to WebP in lossless mode typically saves 20–30% with pixel-identical output, and is the easiest win available for web graphics that need transparency. AVIF often goes smaller still, at the cost of slower encoding.
Converting PNG to JPG discards transparency and introduces permanent compression artefacts, so it is only worth doing for photographs. If you must, set a background colour explicitly — otherwise your transparent areas will come back as an unpredictable solid block.