A looping clip of a product in use, a short how-to, a spinning logo: animated GIFs are easy to make and easy to drop into any page builder. They are also one of the least efficient ways to put movement on a page. This article explains why, and walks through three lighter options, from a straight swap to removing the file altogether.
Why GIFs are so heavy
GIF is an old image format. MDN's image format guide explains that each frame uses a palette of at most 256 colours, compressed losslessly, and that converting full-colour images to GIF “can result in unsatisfactory dithering”. Video formats were designed for moving pictures; GIF wasn't.
The difference can be large. In web.dev's guide to replacing GIFs with video, a 3.7 MB GIF became a 551 KB MP4 and a 341 KB WebM. Your own files will differ, so measure them: a GIF that runs for a few seconds is worth comparing with the rest of the page's images.
What a carbon test sees
GreenTracer measures one first, uncached load of the page with Google PageSpeed Insights, without scrolling. A GIF near the top of the page is counted in full. Under the Sustainable Web Design Model v4, about 0.148 g CO₂e per MB per page view, a 3.7 MB file works out at about 0.55 g on its own. That is above the E-grade limit of 0.359 g before any other file has loaded. The 341 KB WebM from the same example would be about 0.05 g.
PageSpeed Insights flags this too. Lighthouse's “Use video formats for animated content” advice has moved into the “Improve image delivery” insight as of Lighthouse 13, so look there. To find large GIFs yourself, see how to check your page weight.
Option 1: a short, silent video
The most direct swap is a video that behaves like a GIF. web.dev uses four attributes: autoplay, loop, muted (GIFs are silent) and playsinline (so it plays in place, not full screen):
<video autoplay loop muted playsinline width="640" height="360">
<source src="demo.webm" type="video/webm">
<source src="demo.mp4" type="video/mp4">
</video>- Muted matters. MDN's autoplay guide says you can generally expect autoplay to be allowed only if, among other conditions, the audio is muted or the user has already interacted with the site.
- Offer both formats, WebM first. web.dev notes that not every browser supports WebM, and that browsers don't pick the best source for you, so the order matters.
- Conversion is quick. web.dev gives ready-made ffmpeg commands; many image services and CDNs can also convert GIFs to video, according to the Lighthouse guidance.
Autoplay or click to play?
An autoplaying video still downloads for every visitor. MDN's video element reference notes that autoplay takes precedence over preload, because the browser has to start downloading to play. It is lighter than the GIF, but not free.
The W3C's draft Web Sustainability Guidelines go further, suggesting autoplay be disabled by default and that users can start, pause and stop moving content. Accessibility points the same way: WCAG success criterion 2.2.2 Pause, Stop, Hide asks for a way to pause moving content that starts automatically, lasts more than five seconds and sits alongside other content.
A practical rule: a short decorative loop can autoplay muted. A demo or how-to that people actually watch is better as click to play, with controls, a poster image and preload="none", so only the poster loads until someone presses play. Our article on video without the weight covers posters and preload in detail.
Option 2: animated WebP or AVIF
If your site or page builder only accepts images, animated WebP and AVIF keep the GIF's simplicity. MDN describes AVIF's animation support as “similar to animated GIFs, but with much better compression”, and notes that WebP supports animation and looping too. MDN advises providing a fallback format with the <picture> element, particularly for AVIF. For simple lossless animations such as progress indicators, MDN suggests APNG instead.
Bear in mind that an animated image has no play or pause button, so the accessibility point above still applies to long loops. For still images, see image formats compared.
Option 3: CSS, or no animation
Spinners, a gently pulsing button or a fade-in don't need a file at all. CSS can do them in a few lines. web.dev's animation guide recommends sticking to opacity and transform so the browser avoids extra layout and paint work.
Respect visitors who have asked their device for less motion. The prefers-reduced-motion media feature detects that setting, and MDN lists it as widely available since January 2020.
Finally, the cheapest option of all. The WSG's first animation criterion is to use animation only when it supports the user experience or helps people understand something. A sharp still photo sometimes says as much as the loop. Whatever you choose, check the page again and compare the bytes measured with the earlier report.
Sources
- web.dev: replace animated GIFs with video for faster page loads
- MDN: image file type and format guide
- MDN: the video element
- MDN: autoplay guide for media and Web Audio APIs
- Chrome for Developers: use video formats for animated content
- web.dev: how to create high-performance CSS animations
- MDN: prefers-reduced-motion
- W3C: Web Sustainability Guidelines (Group Note Draft), guidelines 2.9 and 2.10
- W3C WAI: Understanding success criterion 2.2.2 Pause, Stop, Hide
- Sustainable Web Design: estimating digital emissions (SWDM v4)



