The short version
- For websites and social media, MP4 and WebM are usually much smaller than GIF for the same loop and show smooth colour.
- GIF can show at most 256 colours in each frame, which makes gradients band or look speckled.
- GIF remains the practical choice for animation in email, because most email clients don't play video.
- WebM is often smaller than MP4, but MP4 plays almost everywhere, so websites commonly offer both.
- Animated WebP and AVIF are modern image formats that replace GIF on websites, but they are not a safe choice for email.
On this page
GIF vs MP4 is decided by where the loop will play. On websites and social media, MP4 (and its open cousin WebM) is almost always the right choice: files are usually far smaller, colour is smooth and playback is efficient. GIF is still the right choice in one place, email, because most inboxes show animated GIFs and very few play video. Everything else in this guide is detail on that rule.
What each format actually is
GIF is an image format from the late 1980s that can hold several frames. It stores each frame with a palette of at most 256 colours and compresses each frame on its own terms. MP4 and WebM are video formats. They use modern video codecs, such as H.264 in MP4 and VP9 or AV1 in WebM, which store what changes between frames rather than every frame in full. For a loop where most of the picture changes slowly, that difference is enormous.
| Feature | GIF | MP4 | WebM |
|---|---|---|---|
| Colours | Up to 256 per frame | Millions | Millions |
| File size for a loop | Largest | Small | Often smallest |
| Transparency | On or off per pixel, no soft edges | No | Yes, in some browsers |
| Sound | No | Yes | Yes |
| Websites | Yes, as an image | Yes, as a video | Yes, in modern browsers |
| Most clients | Rarely | Rarely | |
| Social uploads | Varies by platform | Everywhere | Some platforms |
Why gradients look bad as GIFs
A smooth gradient across a 1080 pixel frame can use thousands of distinct colours. A GIF frame can hold 256 at most. The encoder has two choices: round colours to the nearest one in the palette, which produces visible stripes, or scatter pixels of neighbouring colours to fake the in-betweens, called dithering, which looks speckled and makes files bigger. Neither looks like the gradient you designed.
Grain helps a little, because noisy images hide palette limits better than clean ones. But the real fix is not to use GIF where video is possible. Gradient banding explains the same problem in still images.
MP4 or WebM for websites
For a website, replace GIFs with a video element that behaves like one: autoplaying, muted, looping and inline. web.dev's guide to replacing animated GIFs with video explains the approach. Offer WebM first, since it is often smaller, and MP4 as the fallback that plays almost everywhere.
<!-- Instead of <img src="loop.gif" alt=""> -->
<video autoplay muted loop playsinline width="600" height="600"
poster="loop-poster.jpg">
<source src="loop.webm" type="video/webm">
<source src="loop.mp4" type="video/mp4">
</video>Two other formats are worth knowing. Animated WebP and animated AVIF are image formats, used in an ordinary img tag like a GIF, but with full colour and much better compression. Modern browsers support both. They are handy where a CMS or platform only accepts images, but not for email. For full-width backgrounds, read video backgrounds on websites.
Loops for social media
Social platforms are built around video, and MP4 is the format they all accept. Where a platform takes a GIF upload, it often handles it differently from a normal video, so a GIF is rarely an advantage. Export your loop as MP4 at the platform's size, in H.264, and let the platform do the rest. Animated posts vs static covers sizes and settings.
Loops in email: still GIF
Most email clients don't play video, so an animated GIF is the practical way to put motion in an email. Keep it small and treat the first frame as the fallback: some clients, including some versions of classic Outlook for Windows, show only the first frame. Put the message in that frame so nothing is lost. Our guides to email header design and gradients in email cover the rest.
- 1
Keep it short
Two to six seconds is plenty in an email; every frame adds weight.
- 2
Reduce the size and frame rate
Export at the width it displays, often 600 pixels, and at a lower frame rate, such as 10 to 15 frames per second, for slow movement.
- 3
Put the message in frame one
Readers who only see the first frame should still get the point.
- 4
Check the file size
Large GIFs load slowly on phones. If it is heavy, cut length, size or colours before anything else.
Converting between GIF and MP4
ffmpeg, a free command-line tool, handles both directions. Turning video into a good GIF needs a custom palette built from the video itself; turning a GIF into MP4 is simpler.
# MP4 to GIF: 15 fps, 600 px wide, with a palette made from the clip
ffmpeg -i loop.mp4 -vf "fps=15,scale=600:-1:flags=lanczos,split[a][b];[a]palettegen[p];[b][p]paletteuse" -loop 0 loop.gif
# GIF to MP4: H.264, even dimensions, ready for the web
ffmpeg -i loop.gif -movflags +faststart -pix_fmt yuv420p \
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" loop.mp4
# MP4 to WebM (VP9)
ffmpeg -i loop.mp4 -c:v libvpx-vp9 -crf 34 -b:v 0 -an loop.webmpalettegen and paletteuse pick the 256 colours that suit this clip, which is the biggest single improvement to GIF quality.Which format to use, at a glance
| Where it plays | Use | Why |
|---|---|---|
| Website hero or background | WebM with MP4 fallback | Smallest files, smooth colour |
| Inline animation in an article | MP4 video, or animated WebP | Much lighter than GIF |
| Instagram, TikTok, LinkedIn, X | MP4 (H.264) | What platforms expect |
| GIF | The animation most inboxes show | |
| Chat apps and stickers | Whatever the app asks for | Each app has its own rules |
If you make loops in Gradiently, the Studio exports both: a video (MP4 where your browser can record it, otherwise WebM) up to 1080p, and a GIF with a choice of quality that is kept under 15 MB. Make sure the loop joins cleanly whichever you choose; see seamless loops.
Questions people ask
Is MP4 better than GIF?
For websites and social media, yes: MP4 files are usually far smaller and show smooth colour, while GIF is limited to 256 colours per frame. GIF is still the better choice for email.
Why do my gradient GIFs look striped?
GIF can hold at most 256 colours per frame, so smooth gradients are rounded into bands or dithered into speckles. Use video where you can, or build a custom palette when exporting.
Should I use WebM or MP4?
On websites, offer WebM first because it is often smaller, with MP4 as a fallback because it plays almost everywhere. For social uploads, use MP4.
Can I put a video in an email?
Very few email clients play video. Use an animated GIF, keep it small and make sure the first frame carries the message, since some clients show only that frame.
What is animated WebP?
It is an image format that can hold animation with full colour and better compression than GIF. Modern browsers support it, but email clients generally don't.
Written by Gradiently
The team behind Gradiently, a design tool built around Marks: living gradients that make everything you design look like yours.
See our profile


