What is the difference between PNG-8 and PNG-24?

PNG-8 is an indexed PNG limited to a palette of at most 256 colors, while PNG-24 stores 8 bits per red, green and blue channel, allowing about 16.7 million colors.

By · Updated

Want the full walkthrough? Read: Why is my PNG file so large? →

Explained in more detail

These names are common shorthand from image editors, not formal terms in the PNG specification. The specification defines color types and bit depths; "PNG-8" and "PNG-24" describe the most common combinations.

PNG-8 means indexed color. The file contains a palette of up to 256 colors, and each pixel stores only a number pointing into that palette. Because each pixel needs 8 bits or fewer, files are small. Transparency is possible through a table that assigns an alpha value to each palette entry, so PNG-8 can have transparent or semi-transparent entries. Its limit is the palette: a photo or a smooth gradient needs more than 256 colors, so reducing to PNG-8 causes visible banding unless dithering is used.

PNG-24 means truecolor with 8 bits per channel: three channels at 8 bits is 24 bits per pixel, which allows 2^24 = 16,777,216 colors. A plain 24-bit PNG has no alpha channel. Add an 8-bit alpha channel and you get 32 bits per pixel, which editors often call PNG-32. That is the variant used for most transparent logos and cut-outs.

The practical result is file size. A flat logo with a few colors saved as PNG-8 can be much smaller than the same logo as 24-bit PNG, with no visible difference. A photograph or smooth gradient needs 24-bit.

If an image is flat-colored and your PNG is large, reducing it to an indexed palette is one of the most effective fixes.

Related terms

Try it in Triim

Further reading

Sources

Part of the Triim image terms glossary, by Rocco Bombardieri.