GIF stores each pixel as an index into a color table, and the format allows at most 256 entries per table. That 8-bit limit is why photos band and why encoders quantize colors and optionally dither. PNG, WebP, and JPEG can store far more color detail.
The 256-color limit is not an arbitrary encoder setting. It is part of how the GIF file format stores pixels. Understanding it explains why a photo looks different after conversion, why logos usually survive, and why dithering exists.
An index, not a color per channel
A modern image format like PNG or JPEG can store a red, green, and blue value for every pixel. GIF does something different: it stores one number per pixel, and that number is an index into a table of colors.
The GIF color table is limited to 256 entries. That is where the 8-bit association comes from: an index needs eight bits to address 256 slots. The table size is stored as a power of two, so a GIF can have 2, 4, 8, 16, 32, 64, 128, or 256 colors, but never 257.
A GIF can have a global color table shared by all frames, and it can also give a frame its own local table. That does not raise the ceiling for a single frame: each frame still references at most 256 entries.
How the palette is chosen
A photo starts with thousands or millions of distinct colors. The encoder has to choose a smaller set that represents the image well. The tool used here builds a palette with median-cut quantization: it repeatedly splits the color space into boxes and picks representative colors from each box.
The quality of that palette matters more than the number 256 suggests. A good palette spends its entries on the colors that occupy large areas or carry important detail. A bad palette wastes entries on near-duplicates and leaves skin tones or skies with only a few slots.
After the palette exists, every pixel is mapped to its nearest palette entry. That step is where the original color information is lost. The GIF is now an indexed image, and the missing colors cannot be recovered by decompression.
What dithering does
If you map a smooth sky to 16 or 32 colors, you get visible bands. Dithering breaks up those bands by mixing neighboring palette colors. A pixel that should be a color halfway between two palette entries becomes one entry or the other, and the error is pushed to adjacent pixels.
Floyd–Steinberg dithering is the classic error-diffusion method. It looks at the difference between the original pixel and the chosen palette color, then spreads that difference across nearby pixels. The result reads as a smoother gradient at normal viewing size, at the cost of a grainy texture up close.
Dithering does not add colors. The file still has at most 256. It changes the spatial pattern, not the palette.
Why photos suffer and logos don’t
A logo often uses a small number of flat colors. If the palette includes those colors exactly, the indexed image is nearly identical to the original, and dithering has nothing to fix. A photo is the opposite: skin, sky, foliage, and fabric contain subtle transitions that a 256-entry table cannot hold.
That is why the same GIF settings can produce a clean sticker and a banded landscape. The format is not behaving inconsistently; the content is asking for different amounts of color.
Transparency adds another constraint. A GIF can reserve one palette entry as the transparent index. That leaves at most 255 opaque colors for the frame. With soft alpha, the encoder cannot represent partial transparency at all; a pixel is either in the palette or transparent.
Is GIF lossless?
The LZW compression step is lossless: decompressing the indexed pixels gives back the same indexes. But the conversion from a full-color image to an indexed image is lossy. The palette reduction happens before compression. Calling a photo GIF “lossless” because LZW is lossless misses the larger loss.
This is also why re-encoding a GIF cannot recover detail. Once the palette has been reduced, a second encoder only sees the reduced colors.
When to use a different format
Use GIF when compatibility is the main requirement or when the image has few enough colors that the palette is not a real constraint. Use PNG for lossless stills with full alpha. Use WebP or AVIF for smaller photographic images on the web. Use animated WebP or APNG when you need animation with more colors or full alpha and the destination supports it.
The GIF vs WebP vs APNG guide covers the animated-format decision. The JPG to GIF page explains what the palette limit means for a JPEG photo specifically.
If you want to see the effect on your own image, open the converter, switch between the smooth and flat quality settings, and compare the preview. The difference is the palette and dithering doing their job — or not.
Sources
Related guides
image-to-gif.com converts images to GIF in the browser; files are never uploaded.
FAQ
Can a GIF have more than 256 colors?
Not in one color table. GIF allows a global table and optional local tables per frame, but each table is limited to 256 entries. A frame cannot reference more than 256 colors at once.
Does dithering add more colors to a GIF?
No. Dithering mixes the existing palette colors in a pattern so the eye perceives a smoother transition. The file still contains at most 256 colors per frame.
Why does my GIF look grainy?
That is usually dithering. The encoder is spreading quantization error across neighboring pixels to avoid hard bands. Turning dithering off gives cleaner flat areas but can make gradients band.
Is GIF lossless?
The LZW compression step is lossless, but converting a photo to GIF is not. The palette reduction throws away color information before compression. The result is smaller, not identical.
Does transparency use one of the 256 colors?
Yes. When a GIF uses a transparent index, that palette entry is reserved for transparency, leaving at most 255 opaque colors.