GIF, short for Graphics Interchange Format, is one of the oldest image formats on the web — and still the simplest way to share a short animation that plays everywhere, loops forever and needs no player.
A short history
CompuServe introduced GIF in 1987 (version GIF87a) to send images over slow modem connections. The 1989 update, GIF89a, added transparency and timing between images. In 1995 Netscape Navigator 2.0 added a small extension that tells a browser to repeat the sequence — that is how the looping animated GIF was born.
How a GIF stores an image
Every frame is drawn from a palette of at most 256 colours. A file can have one global palette for all frames and a local palette for individual frames. One palette entry can be marked as transparent; there is no partial transparency.
The pixels are compressed with LZW, a lossless method that replaces repeating sequences with short codes. That is why flat colours and horizontal patterns compress very well, while noise, gradients and heavy dithering make files big — see Dithering.
Animation
An animated GIF is a sequence of frames, each with its own delay in hundredths of a second. A frame does not have to cover the whole canvas: it can update only the area that changed, and a disposal method decides what happens to it before the next frame. Tools like Gifsicle use this to cut file size.
Good to know: most browsers slow down delays below 0.02 seconds to 0.1 seconds, so very short delays make an animation slower, not faster.
Why GIF for 128KB
The format has hard limits — 256 colours, no partial transparency, compression that rewards simplicity — and every decision in your sketch shows up in the file size: canvas size, number of frames, colours, noise. That makes GIF a good playground for working within constraints. The Anatomy of a GIF goes deeper into the file structure.