SquishPixel Blog · Image formats · Image optimisation · Web performance

One 7.2-second loop shrank from 2.77 MB as a GIF to 370 KB as animated WebP

According to DEV Community, an animated GIF is the largest way to ship a looping clip. The author encoded one 7.2 second, 480 × 320 animation in three formats and compared the file sizes.

The GIF came to 2,765,971 bytes. The MP4 video was 840,410 bytes. The animated WebP was 370,392 bytes, or 13.4% of the GIF. The loop and the duration were the same in all three. The GIF and the WebP each held 30 frames. The MP4 held 72, so it kept more of the motion while still coming in at under a third of the GIF's size.

The article recommends a muted, looping video for short clips. If you need something that works as a plain image tag, it suggests animated WebP, with the GIF kept as a fallback for browsers that cannot show it.

The author also flags a risk in image tools. Their own engine rejects animated input on purpose, returning the message "Animated images are not supported yet" for multi-frame WebP and not accepting GIF input at all. They prefer a loud failure to a silent one. A tool that takes a GIF and returns a single still frame loses the animation with no error.

The piece also explains why Save Image As often gives you a .webp file. Sites like Giphy serve WebP to browsers that support it. In the author's sample of 8 Giphy GIFs, the WebP was about 35% of the GIF size at the median.

Why it matters

Animated GIFs are often used for short demos, product loops and decorative motion. They can be heavy, and heavy files slow down pages, especially on mobile connections. In this test, a single clip weighed over 2.7 MB as a GIF and far less in the other formats.

The caveat about tools matters too. If you run images through a compression or conversion step, an animation may be flattened to one frame without any warning. The author also notes this is one test: one animation made of six photos, with one encoder per format. A clip with flat colours and few colours per frame would favour GIF more than this one did, so your own results may differ.

Source: DEV Community. This brief summarises their reporting; read the original for the full detail.