Use Video Formats for Animated Content: Replace Heavy GIFs
- September 3, 2023
- Performance, Media
<video autoplay muted loop playsinline> element. Video files are often 5 to 10 times smaller than the same GIF, so the page loads faster, your Largest Contentful Paint improves, and visitors burn less mobile data. Static images and tiny GIFs are fine to leave alone.What this means
The GIF format was never designed to carry video. It stores every frame as a full image with a limited 256-color palette and no real compression, so a few seconds of motion can balloon into several megabytes. Modern video codecs (H.264 in MP4, VP9 in WebM) compress the same animation far more efficiently. This check, "Use Video Formats for Animated Content," asks you to deliver looping animations as a short, silent, auto-playing video instead of a heavy GIF. The visible result on the page looks identical to your visitor. Only the file size changes.
Why it matters
A single hero GIF can weigh more than an entire well-built page. Google's own example shows a 3.7 MB GIF dropping to a 551 KB MP4 and a 341 KB WebM, the same animation at roughly one tenth the size. Those saved bytes pay off in three ways:
- Faster load and better LCP. If the GIF is the biggest element above the fold, it is very likely your Largest Contentful Paint element. Shrinking it directly improves that Core Web Vital.
- Less wasted data. Mobile visitors on metered connections download a fraction of the bytes, which lowers bounce on slow networks.
- Lighter rendering. The browser decodes a compressed video stream instead of holding a huge multi-frame image in memory.
How it gets flagged
Lighthouse raises this check when it finds an animated GIF that is large enough to be worth converting (the audit looks at GIFs roughly 100 KB and up that have potential byte savings as video). It reports the estimated savings in kilobytes and seconds for each flagged file. As of Lighthouse 13 the standalone audit was folded into the broader "Improve image delivery" insight, so depending on your tooling version you may see it grouped there. SEO ProCheck surfaces the same finding so you can act on it regardless of which Lighthouse build produced it. Static images, including non-animated GIFs and PNGs, are never flagged by this check. Those belong under Properly Size Images instead.
How to fix it
Re-encode the GIF to both MP4 and WebM, then replace the image with a video element. FFmpeg is the standard free tool for the conversion. For MP4:
ffmpeg -i my-animation.gif -b:v 0 -crf 25 -f mp4 -vcodec libx264 -pix_fmt yuv420p my-animation.mp4
WebM is smaller still, and generating both gives the browser its best option:
ffmpeg -i my-animation.gif -c vp9 -b:v 0 -crf 41 my-animation.webm
Then swap the GIF for a video element. List WebM first so supporting browsers pick the lighter file, and keep the four attributes that make a video behave like a GIF:
<video autoplay muted loop playsinline> <source src="my-animation.webm" type="video/webm"> <source src="my-animation.mp4" type="video/mp4"> </video>
What each attribute does:
- autoplay starts the clip on load, the way a GIF runs by itself.
- muted is required for autoplay to work; browsers block sound that starts on its own.
- loop repeats the animation endlessly.
- playsinline stops iOS from forcing the clip into a fullscreen player.
Two notes on encoding. The libx264 encoder needs even pixel dimensions, so resize odd-sized GIFs (for example 321px to 320px) before converting. Also set a width and height (or a CSS aspect ratio) on the video element so the browser reserves space and does not shift your layout. On WordPress, the simplest path is to upload the MP4 and WebM to the Media Library and paste the markup into a Custom HTML block. For a broader take on serving the right format everywhere, see our complete image SEO guide.
False positives
A flag is not always worth acting on:
- Tiny GIFs. A small icon or spinner may technically be a GIF but saves almost nothing as video. The estimated savings will be near zero. Leave it.
- Third-party or ad GIFs. If the file is served by an embed or ad network you do not control, you cannot re-encode it. Note it and move on.
- Transparent animations. MP4 has no alpha channel. If your GIF needs transparency over a varied background, use WebM (which supports alpha) or animated WebP rather than forcing MP4.
- Already a static image. If the "GIF" never animates, it is just a heavy still image and belongs under a sizing or format check, not this one.
FAQ
Will the video lose quality compared to the GIF?
No. Video usually looks better. GIFs are capped at 256 colors, while H.264 and VP9 keep full color. The CRF values above (25 for MP4, 41 for WebM) balance quality and size; lower the number for higher quality if needed.
Do I really need both MP4 and WebM?
Providing both is safest. WebM is lighter and is picked first by browsers that support it; MP4 is the universal fallback. With both listed as sources, every browser gets a working file.
Why does autoplay need muted?
Browsers block videos that start playing with sound on their own. Adding muted satisfies that policy, and since the clip replaces a silent GIF there is no audio to lose anyway.
Is animated WebP an option too?
It can be, and it supports transparency. For most pages, though, an MP4 plus WebM video gives the smallest files and the widest support, which is why this check points at video formats first.
Want a full sweep of the heavy media and performance issues holding your pages back?
Claude Vincent is a technical SEO consultant focused on crawlability, rendering, and AI-search visibility. He writes the field guides and case studies at SEO ProCheck, with a bias toward the durable, unglamorous work that decides whether search engines and AI answer engines can actually read and cite a site.
About SEO ProCheck
Technical SEO consulting and GEO strategy with 20 years of enterprise experience. Case studies, resources, and tools for search and AI visibility.
Work With Me
Technical SEO audits, GEO strategy, site migrations, and international SEO. Hourly consulting for teams who need hands-on support, not just reports.








