Convert Animated GIF to WebP: Compression and Timing

Converting animated GIFs to the modern WebP format significantly reduces asset sizes while maintaining the original animation speed and cadence. This performance gain occurs because WebP applies modern video-grade compression algorithms, variable intra-frame updates, and 24-bit color support to eliminate the overhead of legacy GIF encoding, all while utilizing a container specification that preserves exact millisecond frame-delay metadata.

How WebP Preserves Frame Timing

Animated GIFs store timing information within Graphic Control Extension blocks, which define delays in hundredths of a second (centiseconds). A common issue with GIF playback across different browsers is the handling of very small delays; for instance, zero or sub-20ms values are often clamped to a default 100ms penalty by rendering engines to avoid locking the CPU.

WebP solves this by utilizing the ANMF (Animation Frame) chunk within its RIFF container format. Each ANMF chunk defines the spatial coordinates, duration, and disposal method for that specific frame. Frame duration in WebP is defined explicitly in integer milliseconds (1/1000th of a second). When a GIF is transcoded to WebP, the original centisecond delays are directly converted into their exact millisecond equivalents. Because modern browsers parse WebP animations using modern media pipelines, these millisecond timestamps are rendered faithfully without the legacy compatibility quirks found in old GIF decoders.

Why WebP Slashes File Payload

The dramatic reduction in payload—often ranging from 60% to over 90%—stems from the technical limitations of the GIF specification compared to modern compression standards.