GIF Ready
← GIF Guides

What Is a GIF? How the Format Works and Why It's Still Everywhere

GIF stands for Graphics Interchange Format, an image format CompuServe introduced in 1987. A GIF can hold a single image or a sequence of frames that play as a short, silent, looping animation. It's limited to 256 colors per frame and its files are large, but it plays almost everywhere without a video player, which is why it's still so common.

A short history

The name's pronunciation is still argued about. The format's creator says it with a soft G, like "jif". Plenty of people use a hard G. Both are understood.

How a GIF works

Frames

An animated GIF is a list of images stored one after another. Each frame can cover the whole canvas or just a small rectangle that changed since the last frame. Each frame also has a disposal method that tells the viewer what to do before drawing the next one: leave it, clear it, or restore what was there before.

Palettes

Each frame uses a palette of up to 256 colors. Every pixel is stored as a number pointing to one of those colors. That works well for logos and cartoons but poorly for photos, where smooth gradients need thousands of shades. To fake the missing colors, encoders use dithering, a pattern of mixed pixels that looks grainy up close.

One palette entry can be marked as transparent. Transparency is on or off per pixel, with no partial opacity.

Delays

Each frame stores how long to stay on screen, in hundredths of a second. A delay of 10 means 0.1 seconds, or 10 frames per second. Most browsers treat very short delays (0 or 1) as about 0.1 seconds, which is why some GIFs can't go faster. The guide on changing GIF speed covers this.

Why GIFs are so big

GIF compression is lossless and works on rows of pixels. It has no idea that two frames look almost the same, unlike video codecs, which only store what moved. So a few seconds of GIF often costs as much as a much longer video.

FactorEffect on size
DimensionsDoubling width and height roughly quadruples the size
Frame countMore frames, more data, almost linearly
Colors and noiseDithering and grain compress badly
MotionCamera movement changes every pixel on every frame

You can shrink a GIF a lot by cutting dimensions and frames, then applying lossy compression and fewer colors. The GIF compressor does the last two in one step. See how to compress a GIF without losing quality for the full process.

Why GIFs are still everywhere

When to use something else

Many "GIFs" you see on large sites are actually MP4 or WebP files presented like GIFs. Video is usually several times smaller with better color.

For a deeper comparison of the two most common choices, read GIF vs MP4.

Try it