The Problem with Animated GIFs

Animated GIFs have been on the web since 1989 and remain popular for sharing short looping animations and reaction clips. But GIF is a deeply outdated format, and it shows. GIF files are enormous compared to modern video formats, they support only 256 colors per frame, and they have no audio track. Despite all this, they remain ubiquitous — partly out of habit, partly because they're easy to share.

Modern web development best practices recommend replacing GIFs with short looping video files — and WebM is the best format for doing exactly that.

WebM vs GIF: By the Numbers

PropertyGIFWebM (VP9)
Color depth256 colors maxFull color (millions)
Transparency1-bit (on/off)Full alpha channel
Typical file sizeLarge (often 2–10x bigger)Much smaller
Audio supportNoneYes (Opus)
Browser supportUniversalVery broad (with MP4 fallback)
CompressionLZW (very inefficient for video)VP9 (modern, efficient)

How Much Smaller Is WebM?

File size comparisons vary by content, but WebM video is typically 5x to 20x smaller than an equivalent GIF. A GIF that weighs 5MB can often be reduced to under 500KB as a WebM, with noticeably better visual quality. For a page that loads multiple animations, this difference has a substantial impact on page load time and Core Web Vitals scores.

How to Convert GIF to WebM

FFmpeg makes GIF-to-WebM conversion easy:

ffmpeg -i animation.gif -c:v libvpx-vp9 -crf 30 -b:v 0 -an output.webm

The -an flag removes audio (GIFs have none, so this keeps the output clean). For a simultaneous MP4 output for Safari fallback:

ffmpeg -i animation.gif -c:v libx264 -pix_fmt yuv420p -movflags faststart output.mp4

Embedding Looping WebM as a GIF Replacement

The trick to making a WebM video behave exactly like a GIF is using the right attributes:

<video autoplay muted loop playsinline>
  <source src="animation.webm" type="video/webm">
  <source src="animation.mp4" type="video/mp4">
</video>
  • autoplay: Starts immediately without user interaction
  • muted: Required for autoplay to work in most browsers
  • loop: Repeats like a GIF
  • playsinline: Prevents iOS from going fullscreen

No JavaScript required. No click to play. It just works, like a GIF — but better.

Transparency: The One GIF Advantage

GIF supports 1-bit transparency (each pixel is either fully transparent or fully opaque). WebM with VP9 supports a full alpha channel (varying levels of transparency). This actually makes WebM better for transparency — if you need true alpha in a video, WebM is one of the few formats that supports it natively on the web.

To encode a WebM with transparency:

ffmpeg -i input_with_alpha.mov -c:v libvpx-vp9 -pix_fmt yuva420p output_alpha.webm

Impact on Page Performance

Google's Lighthouse and Core Web Vitals tools specifically flag oversized GIFs and recommend replacing them with video. Switching from GIF to WebM can:

  • Reduce total page weight significantly
  • Improve Largest Contentful Paint (LCP) scores
  • Lower bandwidth usage for both you and your users
  • Deliver smoother, higher-quality animations

The Verdict

There's no technical reason to use animated GIFs in new web projects. WebM (with an MP4 fallback) is smaller, higher quality, more color-accurate, and better for performance. The only barrier is the extra step of conversion — which, as shown above, is a single FFmpeg command. Make the switch and your users will thank you with faster load times and better visual experiences.