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.

Quick answer — MP4 to GIF: Use GIF for email, Slack, GitHub, and Discord (where video won't autoplay). For websites, use an HTML <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

Format5-sec 480p clip5-sec 720p clipAudioColors
MP4 (H.264)0.5–1 MB1–3 MBYes16M+
WebM (VP9)0.3–0.7 MB0.8–2 MBYes16M+
GIF5–20 MB15–60 MBNo256 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

1
FFmpeg Two-Pass Palette Method
Command Line

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

2
Convertlo — No Install, Private
Browser
  1. Open convertlo.pro/mp4-to-gif.html.
  2. Drop your MP4 or click Browse to select it.
  3. Set desired width, frame rate, and duration.
  4. 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):

  1. Reduce resolution — halving the width reduces size by ~75%. Go from 720px to 480px to 320px.
  2. Reduce frame rate — 15fps instead of 30fps halves the file size with minimal visual impact for most content.
  3. Shorten the clip — trim to the essential action only. 3 seconds instead of 8 seconds = more than halved.
  4. Reduce colors — run gifsicle --colors 64 input.gif -o output.gif to reduce from 256 to 64 colors.
  5. Optimize with gifsiclegifsicle -O3 input.gif -o output.gif removes redundant frame data.

Frequently Asked Questions

Why is my GIF so much larger than the MP4?
GIF stores every frame as a complete image using LZW lossless compression with a 256-color palette — no inter-frame compression. Video codecs like H.264 store only the differences between frames. A 5-second MP4 might be 2 MB; the same clip as GIF is commonly 20–50 MB.
What is the best alternative to GIF for websites?
The HTML video element with 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?
For email (clients block video autoplay), Slack/Discord, GitHub READMEs and issues, and Twitter/X uploads. These environments display GIF as auto-looping animation but don't support auto-looping video in the same way.
How do I convert MP4 to GIF with FFmpeg?
Two-step method: Step 1: 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.
How do I reduce GIF file size?
Reduce resolution (halving width cuts size ~75%), reduce frame rate (15fps instead of 30fps), trim duration, reduce colors with gifsicle --colors 64, and optimize with gifsicle -O3. Combining these can reduce a 20 MB GIF to under 2 MB.