An animated GIF is the largest way to ship a loop. We encoded one 7.2 second, 480 × 320 animation three ways: GIF 2,765,971 bytes, MP4 840,410 bytes, animated WebP 370,392 bytes.
That makes WebP 13.4% of the GIF. The loop and the duration were the same.
The numbers
| Format | Bytes | Frames |
|---|---|---|
| GIF | 2,765,971 | 30 |
| Animated WebP | 370,392 | 30 |
| MP4 | 840,410 | 72 |
The GIF and the WebP hold 30 frames each. The MP4 holds 72, so it keeps more of the motion at under a third of the GIF's size. All three run 7.2 seconds.
What to ship
For short clips, use a muted looping video:
<video autoplay loop muted playsinline width="480" height="320" poster="loop.jpg">
<source src="loop.mp4" type="video/mp4">
</video>
For a drop-in <img>, use animated WebP, with the GIF as a fallback:
<picture>
<source srcset="loop.webp" type="image/webp">
<img src="loop.gif" width="480" height="320" alt="Describe the loop" loading="lazy">
</picture>
One catch: tools may refuse animation
Our own engine rejects animated input on purpose. A multi-frame WebP returns "Animated images are not supported yet", and GIF input is not supported. We would rather fail loudly than flatten an animation to its first frame without telling you.
Check your own pipeline. If a tool takes a GIF and returns one still frame, the animation is lost with no error.
Why Save Image As gives you a .webp
Sites like Giphy serve WebP to browsers that support it. In our sample of 8 Giphy GIFs, the WebP came to about 35% of the GIF at the median. That is why right-click, Save Image As, gives a WebP file.
The full guide, with the steps to get a real GIF and the Giphy and Tenor numbers, is how to save a GIF. For still images, the format trade-offs are in AVIF vs WebP vs JPEG.
What we did not test
One animation of six photos, one encoder per format (cgif 0.5.3 for GIF, libwebp 1.6.0 for WebP). A clip with flat colours and few colours per frame favours GIF more than ours did.
Top comments (0)