What is GIF?

GIF is a lossless image format limited to 256 colors per frame that supports simple animation and single-color (on/off) transparency.

By · Updated

Explained in more detail

GIF, short for Graphics Interchange Format, was developed by CompuServe; version 87a dates from 1987 and the 89a revision added the Graphic Control Extension, which carries the transparency index and frame delays used for simple animation. It compresses pixel data with LZW, a lossless algorithm, but each frame is limited to a color table of at most 256 entries, each chosen from a 24-bit color space.

That palette limit is why GIFs of photographs look grainy or banded. The conversion to 256 colors discards information before any compression is applied, often with dithering to disguise it. Flat graphics, pixel art and simple diagrams, which genuinely use few colors, convert with no visible loss.

GIF transparency is binary: one palette entry can be marked transparent, and every pixel is either that entry or fully opaque. There is no partial transparency, so a cut-out saved as GIF has hard, jagged edges, and it will often show a ring of the old background color on a different page color. PNG, WebP and AVIF all support smooth alpha transparency and are better for still images with soft edges.

GIF's staying power is animation. The specification itself says GIF is not intended as a platform for animation, but it can be done in a limited way, and because it is supported by every major browser it became a common format for short looping clips. Alternatives such as animated WebP, animated AVIF and short video are usually smaller for the same content, but GIF's broad support keeps it in use.

For a still image, there is rarely a reason to choose GIF over PNG or WebP today.

Related terms

Try it in Triim

Sources

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