What is indexed colour?
Indexed colour — also called palette colour — stores a small lookup table of colours inside the file. In PNG that table is the PLTE chunk, and it can hold up to 256 entries. Instead of recording the full red, green, and blue values for every pixel, the image records an index that points into that table. The palette holds the actual colours; each pixel just says which palette entry it is.
How does indexed colour save space?
A truecolour pixel needs three bytes (one each for red, green, and blue). An indexed pixel needs only a single byte — or fewer bits when the palette is small — because it stores one index rather than three colour channels. For images with few distinct colours, like logos, icons, and flat graphics, that is a dramatic reduction in file size with no visible change at all.
What is the 256-colour limit and when does it hurt?
The catch is a hard cap of 256 colours per palette. That is plenty for flat artwork but far too few for photographs and smooth gradients, which contain thousands of subtle tones. Squeezing them into 256 colours causes visible banding, so they have to be dithered — scattering palette colours to fake the missing shades. Reducing a truecolour image down to a palette is called quantization, and it is the main lever a PNG optimiser pulls.
How does this relate to PNG-8 and compression?
A PNG that uses indexed colour is exactly what people mean by PNG-8: an 8-bit, palette-based PNG. Because the pixel data is just a stream of small indices, it also compresses very well on top of the savings from indexing. For the full comparison see PNG-8 vs PNG-24, and when you want to shrink an existing file you can compress a PNG to apply quantization automatically.
Can indexed PNGs be transparent?
Yes. An indexed PNG carries transparency through the tRNS chunk, which assigns an alpha value to palette entries — so individual palette colours can be fully or partially transparent without storing a separate alpha channel for every pixel. That keeps cut-out logos and icons small while preserving their transparent backgrounds. If you are new to the format, start with what is a PNG.
Frequently asked questions
- How many colours can an indexed PNG hold?
- Up to 256 distinct colours, stored as entries in the PLTE chunk. Each pixel then references one of those entries by its index.
- What is quantization?
- Quantization is the process of reducing a full-colour image down to a fixed palette of 256 or fewer colours. It is the main lever a PNG optimiser uses to shrink files.
- Can indexed PNGs have transparency?
- Yes. The tRNS chunk assigns an alpha value to palette entries, so an indexed PNG can have transparent or partially transparent areas without a full alpha channel.
- When should I avoid indexed colour?
- Avoid it for photographs and smooth gradients. With only 256 colours available, those images show visible banding and have to be dithered to look acceptable.