PNG isn't just PNG
PNG has a reputation for being big — but that only applies to one of its variants. In truth there are (simplified) two kinds that differ dramatically in file size, even though both are lossless:
- PNG-24 — full color depth, 16.7 million colors per pixel. Needed for photos and fine gradients. Big.
- PNG-8 — indexed palette of at most 256 colors. Ideal for logos and graphics. Tiny.
Save a logo as PNG-24 even though it consists of five colors, and you give away ten times the file size.
How indexed color works
PNG-8's trick is a color table (palette). Instead of storing the complete color for each pixel (three bytes for red, green, blue), PNG-8 builds a list of up to 256 colors and stores only a number per pixel — the index into that list. A pixel then needs just one byte (or less) instead of three. For a logo with eight colors that's an enormous saving, without changing the appearance.
The limit is the 256: as soon as an image needs more colors (every photo has thousands), the palette isn't enough and you have to reach for PNG-24 — otherwise banding appears (see Bit depth and banding).
When PNG-8, when PNG-24?
| Image type | Colors | Recommendation |
|---|---|---|
| Logo, icon | few | PNG-8 (tiny) |
| Diagram, graphic with flat areas | few–medium | PNG-8 |
| Screenshot with text (little photo) | medium | test PNG-8 |
| Screenshot with a photo portion | many | PNG-24 or WebP |
| Photo, gradient | thousands | PNG-24 (or better JPG/WebP) |
Rule of thumb: few flat colors → PNG-8. Photographic content → PNG-24 (or a lossy format straight away, if it's a photo).
The transparency caveat
PNG-8 can do transparency, but classically only as "fully transparent or fully opaque" — without the fine intermediate steps that soft edges and shadows need. For a logo with hard edges that's often enough; for a cut-out subject with a soft edge, PNG-24 with a full alpha channel is the safe choice, otherwise the edges get staircased. How transparency works technically is explained in Alpha channel and transparency.
In practice
Many image editors offer a choice between "PNG-8" and "PNG-24" (or "256 colors" vs. "millions of colors") on PNG export. The test is always worth it: save a logo once as PNG-8 and compare with the original — if it looks the same (usually yes), you've shrunk the file dramatically. For photos, PNG remains the wrong choice generally; there a lossy format wins (see JPG vs PNG).
Frequently asked questions
What's the difference between PNG-8 and PNG-24?
PNG-8 uses an indexed color palette of at most 256 colors — very compact, ideal for logos, icons, and graphics with few colors. PNG-24 stores full 16.7 million colors per pixel — needed for photos and fine gradients, but markedly larger. Both are lossless.
What does 'indexed color' mean?
Instead of storing the full color for each pixel, PNG-8 builds a palette (color table) of up to 256 colors and stores only the number of the color in that table per pixel. This saves enormous space, but only works if the image gets by with 256 colors.
When should I use PNG-8?
For logos, icons, simple graphics, diagrams, and screenshots with few flat colors. There 256 colors are ample, and PNG-8 can shrink the file to a fraction of PNG-24 — with identical appearance.
Can PNG-8 do transparency?
Yes, but limited: PNG-8 supports transparency, classically only all-or-nothing (a pixel is transparent or opaque); modern encoders also allow alpha in the palette. For soft, semi-transparent edges with many gradations, PNG-24 with a full alpha channel is the safe choice.