Blog
How GIF compression works (explained simply)
Palettes, dithering, disposal methods, and why two frames that look alike can still cost you.
1 min read · Updated October 9, 2026 · Transparent GIF maker
A palette, not a photograph
Each GIF frame stores an index into a table of at most 256 colors, not a red-green-blue value per pixel. The encoder’s first job is choosing that table. A good table spends its slots on the colors people notice: skin, a logo, the text.
If the table is too small, skies band into stripes. Dithering mixes neighboring palette colors to fake the missing ones. The picture looks better and the file sometimes gets larger, because noise is harder to compress than a flat stripe.
LZW likes repetition
After the pixels are indexes, LZW compresses repeated sequences. A flat background is cheap. A dithered gradient is expensive. This is why “higher quality” dithering can hurt the file size even when the dimensions stay put.
Transparency is one special index. It is not a fourth channel. Pixels are in or out, which is why edges need a matte instead of a blur.
Frames, disposal, and the lie of “only the changes”
GIF89a can clear the previous frame or leave it and draw the next on top. Encoders use that to store only the rectangle that changed. It helps when a small sprite moves on a still background. It helps less when the whole photograph shifts, because the rectangle is the whole frame.
Camera noise and heavy dithering defeat that trick: every pixel “changed.” Denoise or lower the frame count before you hunt for a cleverer encoder. Video codecs do this job properly. GIF is doing it with the tools of 1989, which is impressive, and also why your three-second loop is 8 MB.