Video to GIF / GIF colours & dithering

Why GIFs have 256 colours, and what dithering does

The grain, stripes and shimmer in GIFs all come from one rule in a 1989 file format. Here's the rule, and how to work with it.

Open the converter

The rule: a palette of 256

A video frame stores a full colour for every pixel: 8 bits each of red, green and blue, about 16.7 million possibilities. A GIF frame stores a small colour table of up to 256 entries, and each pixel is just a number pointing into that table. CompuServe designed it that way in 1987 (revised as GIF89a in 1989) because screens of the time could only show a few hundred colours at once, and because an 8-bit index compresses well with LZW.

So converting video to GIF has two steps that video never needs: quantisation, choosing which 256 colours best represent the clip, and mapping, deciding which of those colours each pixel becomes.

Palette lab: squeeze a sunset into 32 colours

Original (thousands of colours)
32 colours · real GIF frame 0.0 KB
Dithering

Try 16 colours with None: the sky breaks into stripes (banding). Switch to Diffusion and the stripes turn into fine noise your eye blends back into a gradient, but watch the KB figure climb, because noise is exactly what LZW compresses worst.

Three ways to map pixels

No dithering

Each pixel takes the nearest palette colour. Flat areas compress superbly, but smooth gradients break into visible bands. Perfect for screen recordings, logos and cartoons.

Ordered (Bayer) dithering

A fixed 4×4 threshold pattern nudges each pixel before choosing its colour, producing a regular cross-hatch that the eye blends into in-between shades. Because the pattern is tied to pixel position, not content, it stays still from frame to frame, so there's no shimmer and inter-frame compression keeps working. It's the converter's default.

Error diffusion (Floyd–Steinberg)

Robert Floyd and Louis Steinberg published this in 1976: when a pixel is rounded to a palette colour, the error is passed on to its unprocessed neighbours (7/16 right, 3/16, 5/16 and 1/16 on the next row). It gives the smoothest-looking gradients, but the dot pattern depends on the image, so tiny changes between frames rearrange it: static areas shimmer, and the noisy result compresses worst of the three.

Clips that fight the palette

  • Skies and sunsets: long gradients band badly without dithering.
  • Dark scenes: the palette spends its entries on bright areas, leaving shadows blotchy. Brightening the source helps.
  • Foliage: hundreds of slightly different greens. Leaves look green because chlorophyll absorbs red and blue light for photosynthesis, a process ahaboo walks through in a narrated explainer, and those reflected greens must share your 256 slots.
  • Colour that changes over time: a clip that cuts from a red room to a blue sky can't share one palette well. Choose "Per frame" palettes in the converter; the file will be larger because unchanged pixels can't be skipped.

The way out

If colour fidelity matters more than playing everywhere, export animated WebP, which has no palette limit, or share video.

Questions

Why are GIFs limited to 256 colours?

Each GIF frame stores pixels as indexes into a colour table of at most 256 entries (8 bits per pixel). The format dates from 1987–89, when most screens could only show 16 or 256 colours at once.

Can a GIF have more than 256 colours?

Technically, each frame (or tile) can carry its own local colour table, so a clever encoder can exceed 256 across an image, but files balloon and many decoders struggle. For full colour use animated WebP or video.

Which dithering should I use?

Ordered for most camera footage: it hides banding and stays steady between frames. Diffusion for stills or slow scenes where smoothness matters most. None for screen recordings, logos and cartoons with flat colour.

Why does my GIF shimmer?

Error-diffusion dithering changes its dot pattern whenever the frame changes slightly, so static areas can crawl. Switch to Ordered, or None.