The animated GIF format dates to 1987. It uses LZW compression, hard-codes a 256-color palette per frame, and has no concept of inter-frame motion compensation. None of those choices made sense after 1995, but GIF survived because it was the only animation format that worked across browsers without a plugin. In 2026, MP4 (and WebM) are universal in every modern browser, and the file-size gap is enormous. This post lays out the actual numbers.
The compression gap
A typical 480p, 5-second animation:
| Format | File size |
|---|---|
| GIF (default optimization) | 1.8 MB |
| GIF (heavily optimized, 8-color palette) | 900 KB |
| WebP animation | 250 KB |
| WebM (VP9) | 110 KB |
| MP4 (H.264) | 90 KB |
That's a 20x reduction from GIF to MP4, on the same visual content, at higher color fidelity. The reasons go to the heart of how each format compresses:
- GIF stores each frame as a separate image with a 256-color palette. There is no temporal compression. A 30-fps, 5-second animation literally encodes 150 full images.
- MP4 / WebM use motion compensation. They store a keyframe every few seconds, then store only the differences from the last frame. For animations where most of the frame doesn't change between frames (95% of GIFs in the wild), the difference compresses to almost nothing.
- GIF's color palette is dithering hell. Smooth gradients turn into banded noise patterns that the LZW coder can't compress. MP4 doesn't have this constraint — its color space is full 8-bit-per-channel YUV.
Performance impact, beyond download size
File size is only the first cost. The decoder side matters too:
- Decode CPU. GIF must software-decode each frame, then composite. MP4 on every modern device decodes in hardware (the same silicon that handles YouTube). On mobile this is the difference between draining 5% battery while a tab plays an animation versus 0.5%.
- Memory. A long GIF is held entirely in memory while playing — a 50MB GIF eats 50MB+. An MP4 streams as it plays.
- Smoothness. Hardware video decoding hits stable 60fps. Software GIF decode often drops frames on lower-end devices, especially with dozens of GIFs on a page (think product listing thumbnails on shopping sites).
The Lighthouse / Core Web Vitals angle
Google's Core Web Vitals reward fast loads. A 2 MB GIF on a hero section can wreck your Largest Contentful Paint (LCP) score because the browser blocks rendering until the GIF starts to display. Converting that GIF to MP4 — and using autoplay loop muted playsinline — drops the payload by 90%+ and removes the LCP regression.
We've seen sites jump from a Lighthouse score of 60 to 90+ on a single page just from converting hero GIFs to MP4. The browser still treats it like an animation; the user experience is identical; the bandwidth bill drops sharply.
Drop-in replacement: the markup
The HTML for an autoplaying, looping, silent MP4 that behaves like a GIF:
<video autoplay loop muted playsinline src="animation.mp4"></video>
All four attributes matter:
autoplay— start playing immediately.loop— restart at the end (GIF-like).muted— required for autoplay on iOS and most browsers since 2018.playsinline— prevents iOS from opening the video full-screen on tap.
When NOT to convert
- Email. Most email clients still don't support inline video. GIF stays king there.
- Documentation that needs to render in non-browser viewers. Some markdown previewers, embed widgets, and chat apps render GIF but not MP4.
- Animation needs transparent background. MP4 doesn't support transparency. Use animated WebP or WebM with VP9-alpha.
How to convert
For one-off conversions, our GIF to MP4 converter runs entirely in your browser using the WebCodecs API or ffmpeg.wasm. No upload, no third-party servers. For a full pipeline you can drop into CI, the canonical command is:
ffmpeg -i input.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4
The -pix_fmt yuv420p bit ensures Safari can play the result; the scale filter forces even dimensions, which H.264 requires.
Bottom line
GIF is a museum piece kept alive by inertia and email. For anywhere else — your blog, your marketing pages, your documentation, your product UI — converting GIF to MP4 delivers a 10–20x file-size reduction with no perceptible quality loss. The conversion takes seconds. The performance compounds across every visit.