PNG-8 vs PNG-24

One is a 256-colour palette, the other is full colour. The difference in file size can be fourfold — and converting between them is a lossy step that many tools do not admit to.

Head to head

PNG-8 colours
256 total, from a palette.
PNG-24 colours
16.7 million — 8 bits per channel.
PNG-32
PNG-24 plus a full alpha channel. What most transparent PNGs actually are.
Size difference
PNG-8 is often 2–4× smaller on suitable content.
Transparency
PNG-8 is usually binary; PNG-24/32 has 256 levels.
Is converting lossy?
Yes. Quantising to 256 colours discards information permanently.
Good for PNG-8
Flat logos, icons, simple diagrams, few colours.
Bad for PNG-8
Photographs, gradients, soft shadows, anti-aliased edges over varied backgrounds.

Choosing between them

What the numbers mean

PNG-8 stores an index per pixel pointing into a palette of at most 256 colours. One byte per pixel, plus a small palette.

PNG-24 stores three bytes per pixel — one each for red, green and blue at 8 bits. PNG-32 adds a fourth byte for alpha, and is what most "transparent PNGs" actually are, though almost nobody uses the term.

So before compression, PNG-8 holds a third to a quarter of the data. After compression the gap narrows but usually remains substantial on content that suits it.

Quantisation is a lossy step, whatever it is called

This is the part that gets glossed over. Converting to PNG-8 means choosing 256 representative colours and mapping every pixel to the nearest one. Information is discarded permanently.

The PNG file that results is still losslessly compressed — the format has not changed — but the image inside it is no longer what you started with. That is why a "lossless PNG optimiser" claiming 70% savings on a photograph is being misleading: the lossless part is true and irrelevant, because the destructive step happened before it.

On a logo with six flat colours nothing is lost, because there were fewer than 256 to begin with. On a photograph, plenty is.

Dithering, and the trade it makes

To disguise banding after quantisation, encoders can dither — scattering pixels between two palette colours so the eye blends them into an intermediate shade.

It works visually and it costs you the compression. Dithering replaces smooth predictable areas with high-frequency noise, which is precisely what PNG's filtering and DEFLATE are worst at. A heavily dithered PNG-8 can end up larger than the PNG-24 it was meant to replace.

If you find yourself needing heavy dithering, the content is not suited to an indexed palette.

The transparency difference

PNG-8 transparency is usually binary in practice — a pixel is drawn or it is not. The format technically permits variable alpha per palette entry, but tool support is inconsistent and most exporters produce the binary kind.

That means anti-aliased edges come out jagged, exactly as they do in GIF. A logo with a soft outline placed on a coloured background will show a stair-stepped fringe.

PNG-24 with alpha — PNG-32 — has 256 levels of opacity and handles soft edges properly. If the graphic has anti-aliasing and will sit on a varied background, this is not optional.

Which to use

Flat logos, icons, simple diagrams
PNG-8. Often several times smaller with no visible difference at all.
Screenshots of text and interfaces
Try PNG-8 and inspect it. Frequently fine, and a large saving.
Anything with a gradient
PNG-24. Banding will be obvious otherwise.
Soft shadows or anti-aliased edges over varied backgrounds
PNG-24 with alpha.
Photographs
Neither — use JPEG or WebP. PNG is the wrong container regardless of depth.
Anything for the web
Consider WebP instead. Lossless WebP is typically 25% below PNG-24 with full alpha and no quantisation.

What this site does

The PNG compressor here does not quantise. It re-encodes losslessly at full colour depth, so every pixel value in the output matches the input exactly.

That is why its savings are more modest than tools which convert to PNG-8 and still describe the result as lossless. Both approaches are legitimate; only one of them is what the word means. If you want indexed colour, use an editor's export dialogue where the choice is explicit and you can inspect the result.

Try it yourself

Everything below runs in your browser, so you can test any of this on your own files without uploading them.

  • Compress PNG

    Lossless by default, with transparency carried through untouched.

    Open the tool
  • Lossless compressor

    Zero quality loss, every pixel preserved exactly. Honest about how modest the saving is.

    Open the tool
  • Compress WebP

    Re-encode existing WebP files, or convert JPEG and PNG into WebP.

    Open the tool
  • PNG to JPG

    For photographs stored in the wrong container. Transparency is flattened deliberately.

    Open the tool

Questions

Frequently asked questions

Every answer below is present in the page source, expanded, so it can be read without opening anything.

Is PNG-8 lossless?

The PNG compression is, but converting to PNG-8 is not — reducing an image to 256 colours discards information permanently. Tools that quantise and still call the result lossless are describing the second half of the process and ignoring the first.

How much smaller is PNG-8?

Typically two to four times smaller on suitable content — flat graphics with few colours. On photographs and gradients the saving is smaller and comes with visible banding, which is a sign to use a different format entirely.

Does PNG-8 support transparency?

In practice, binary transparency only: a pixel is either drawn or not. That makes anti-aliased edges jagged. For soft edges you need PNG-24 with an alpha channel, sometimes called PNG-32.

What is PNG-32?

PNG-24 plus an 8-bit alpha channel — four bytes per pixel. It is what most transparent PNGs actually are, though the term is rarely used; people usually just say PNG-24.

Why did my PNG-8 come out larger than the PNG-24?

Almost certainly dithering. Scattering pixels between palette colours to hide banding replaces smooth areas with noise, which is exactly what PNG's compression handles worst. If heavy dithering is needed, the content is not suited to an indexed palette.

Should I use PNG-8 or WebP?

For the web, WebP. Lossless WebP is typically 25% smaller than PNG-24, keeps full colour and a proper alpha channel, and requires no quantisation at all — so you get the saving without the trade.

From the blog

Related reading

Longer, more practical guides from the blog.

  • Image Formats

    PNG vs JPEG: When to Use Each, With the File Sizes to Prove It

    PNG stored the same photograph in 1274.1 KB where JPEG needed 67.5 KB — nineteen times larger. On a flat graphic PNG won. On a smooth gradient PNG lost to JPEG by a factor of two, which surprises most people.

    9 min read

  • Image Formats

    WebP vs JPEG: Which Should You Use, and When JPEG Still Wins

    WebP produced a 27.0 KB file against MozJPEG's 41.1 KB on the same photograph at slightly higher measured fidelity — 34% smaller. It also produced a larger file than JPEG on random noise. The advantage is real and content-dependent.

    9 min read

  • Practical Guides

    How to Compress Images for a Website Without Wrecking Them

    Resize before you compress. Measured on one photograph: half the width at quality 80 produced a 16.4 KB file, while full width at quality 40 produced 20.6 KB and looked far worse. The order of operations matters more than the settings.

    8 min read