How to Convert MP4 to GIF — And Why You Probably Shouldn't
Most people convert MP4 to GIF for one reason: they want a looping animation that plays automatically without requiring user interaction. But GIF is the most inefficient format for this use case. A 5-second 720p video at 30fps is 2–4 MB as MP4. The same clip as a GIF is commonly 30–80 MB — 15–40 times larger.
Before you convert, consider: are you embedding this on a website? Then the HTML <video> tag is almost certainly the better choice. Do you need it for email, Slack, GitHub, or Discord? Then GIF is the right choice — those environments don't support auto-looping video. This guide covers both scenarios.
<video autoplay loop muted playsinline> tag instead — same look, 90–95% smaller file. If you do need a GIF: keep it under 5 seconds, 480px wide, 15fps to stay under 5 MB.
Convert MP4 to GIF — Free, No Upload
Browser-based converter. Trim your clip and convert — files never leave your device.
MP4 vs GIF: The Size Reality
| Format | 5-sec 480p clip | 5-sec 720p clip | Audio | Colors |
|---|---|---|---|---|
| MP4 (H.264) | 0.5–1 MB | 1–3 MB | Yes | 16M+ |
| WebM (VP9) | 0.3–0.7 MB | 0.8–2 MB | Yes | 16M+ |
| GIF | 5–20 MB | 15–60 MB | No | 256 max |
GIF has no inter-frame compression — every frame is stored as a complete image using lossless LZW compression with a 256-color palette. Video codecs like H.264 store only the difference between frames, which is why a MP4 can encode 30fps video at 3 MB while GIF needs 60 MB for the same clip.
The Right Answer for Websites: HTML Video Tag
If you're embedding an animation on a webpage, use a video element instead of a GIF. It looks identical — auto-loops, no controls, starts immediately — but is 90–95% smaller.
<!-- Looks exactly like a GIF — but 90% smaller -->
<video autoplay loop muted playsinline>
<source src="animation.webm" type="video/webm">
<source src="animation.mp4" type="video/mp4">
</video>Key attributes: autoplay starts immediately, loop loops forever, muted is required for autoplay to work in Chrome, playsinline prevents fullscreen on iOS. WebM is first (smaller file) with MP4 as fallback for Safari.
Convert MP4 to WebM for the animation source: ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 33 -b:v 0 -an output.webm
When GIF Is Actually the Right Choice
- Email — Most email clients (Gmail, Outlook, Apple Mail) support GIF animation. Video autoplay in email is blocked by almost all clients.
- Slack and Discord — These platforms display GIFs as auto-looping animations. MP4 uploads don't auto-loop in the same way.
- GitHub READMEs and issues — GitHub renders GIFs inline. Video files don't render inline in markdown.
- Twitter/X — Twitter converts GIFs to MP4 internally for efficiency, but accepts GIF uploads natively.
- Short, simple animations — 2–3 second clips with few colors (logos, icons, simple UI demos) are manageable as GIF.
Method 1: FFmpeg — Best Quality GIF
The two-pass method generates an optimal 256-color palette before creating the GIF, resulting in dramatically better color quality than single-pass conversion.
# Step 1: Generate optimal color palette ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png # Step 2: Use palette to create high-quality GIF ffmpeg -i input.mp4 -i palette.png \ -filter_complex "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" \ output.gif # Trim to specific time range (start 0:10, duration 5 seconds) ffmpeg -ss 00:00:10 -t 5 -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png ffmpeg -ss 00:00:10 -t 5 -i input.mp4 -i palette.png \ -filter_complex "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
Key settings: fps=15 = 15 frames per second (reduce for smaller size). scale=480:-1 = 480px wide, maintain aspect ratio. lanczos = high-quality scaling filter.
Method 2: Convertlo Browser Tool
- Open convertlo.pro/mp4-to-gif.html.
- Drop your MP4 or click Browse to select it.
- Set desired width, frame rate, and duration.
- Click Convert and download the GIF.
The browser tool runs FFmpeg.wasm — all processing is local. No upload required.
Reducing GIF File Size
If your GIF is too large, these are the most effective optimizations (in order of impact):
- Reduce resolution — halving the width reduces size by ~75%. Go from 720px to 480px to 320px.
- Reduce frame rate — 15fps instead of 30fps halves the file size with minimal visual impact for most content.
- Shorten the clip — trim to the essential action only. 3 seconds instead of 8 seconds = more than halved.
- Reduce colors — run
gifsicle --colors 64 input.gif -o output.gifto reduce from 256 to 64 colors. - Optimize with gifsicle —
gifsicle -O3 input.gif -o output.gifremoves redundant frame data.
Frequently Asked Questions
Why is my GIF so much larger than the MP4?
What is the best alternative to GIF for websites?
autoplay loop muted playsinline. It looks like a GIF — auto-loops, no controls — but is 90–95% smaller. Use <source src="animation.webm"> first, with MP4 as fallback for Safari.When should I still use GIF instead of MP4?
How do I convert MP4 to GIF with FFmpeg?
ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png. Step 2: ffmpeg -i input.mp4 -i palette.png -filter_complex "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif. The palette step dramatically improves color quality.