How to Convert GIF to MP4 (Smaller File, Better Quality)

GIF MP4 Video Web Performance Animation FFmpeg
GIF vs MP4 — the case for converting
90–95%smaller file size
16Mcolors vs GIF's 256
1987when GIF was invented
2 minto convert

A 5-second screen recording you wanted to share. You exported it as a GIF, the file was 8 MB, and now your message won't send, your page loads slowly, or your upload hits the size limit. Converting that GIF to MP4 takes two minutes and the result is typically 200–400 KB — a 95% reduction, identical frames, and better colour accuracy. This guide covers every method, from a one-click browser converter to the FFmpeg command you'll use for everything after.

1. TL;DR — Quick Answer

90–95%
typical file size reduction
16M
colors in MP4 vs 256 in GIF
0
visible quality loss (usually better)
2 min
to convert in browser

The short answer: Converting a GIF to MP4 produces a dramatically smaller file with better visual quality. A 5MB animated GIF typically becomes 200–400KB as an MP4 at the same frame rate and duration — a 90–95% reduction. MP4 (H.264) is not limited to GIF's 256-colour palette, so the converted video also has better colour accuracy. Use the Convertlo GIF to MP4 converter — free, browser-based, nothing uploaded to a server.

2. Why GIFs Are So Large

GIF was invented in 1987 by CompuServe engineer Steve Wilhite, when "compression" meant something very different than it does today. Three fundamental limitations make GIF inefficient for video-like content:

256-Colour Limit Per Frame

Each frame in a GIF can only contain 256 colours, chosen from the full RGB palette. Real photographs and screen recordings contain thousands of distinct colours — everything beyond the 256-colour limit is approximated through dithering (a pattern of different-coloured pixels that tricks the eye into seeing more colours). This dithering is visible as a grainy, stippled texture in GIFs with gradients, skin tones, or smooth backgrounds. It also increases file size because random-looking dither patterns compress poorly.

Full Frame Storage

GIF stores each frame as a complete image. A 2-second animation at 15 fps is 30 complete images, each compressed independently with LZW. There is a partial workaround — "delta" GIFs that only store the changed pixels between frames — but browser and tool support for this technique is inconsistent, and the GIF specification doesn't make it straightforward.

LZW Compression (From 1984)

GIF uses Lempel–Ziv–Welch compression, a general-purpose algorithm from 1984 that was designed for text and simple graphics, not photographic content or animation. Modern video codecs like H.264 use motion compensation, discrete cosine transform, and entropy coding specifically optimized for video — algorithms developed decades after LZW. The gap in compression efficiency between GIF and H.264 is enormous.

3. Why MP4 Beats GIF in Every Way

Property GIF MP4 (H.264) Winner
Colours per frame 256 16,777,216 MP4
File size (5-second clip) ~5 MB typical ~200–400 KB MP4 (90–95% smaller)
Compression type LZW (1984) H.264 motion compensation MP4
Transparency Binary (on/off) Not in H.264 GIF
Animation/looping Native Via HTML loop attribute Tie
Browser support Universal Universal Tie
Email client support Universal Poor (Outlook) GIF
Visual quality Dithering, banding Full colour, smooth MP4

The one area where GIF still wins is email. MP4 has universal browser support, but email clients — particularly Outlook — don't render video. For everything else (websites, social media, messaging apps, Discord, Slack), MP4 is strictly better.

Convert GIF to MP4 — Free, Browser-Based

FFmpeg runs entirely in your browser. No upload, no signup, no file size limits that matter for typical GIFs.

4. How to Convert GIF to MP4 (Browser, Free)

The fastest route requires no software installation. Convertlo runs FFmpeg as WebAssembly directly in your browser — your GIF never leaves your device.

1
Open the converter

Go to convertlo.pro/gif-to-mp4. No account, no login.

2
Drop your GIF

Drag your GIF onto the converter zone, or click to browse. Files up to 50 MB work fine.

3
Wait for FFmpeg

First use downloads ~10 MB of WebAssembly — cached after that. A typical 3–5 MB GIF converts in 5–20 seconds.

4
Download your MP4

Click Download. Compare the file sizes — you'll typically see 90–95% reduction.

5. FFmpeg: The Command-Line Method

If you need to convert GIFs in bulk, or want precise control over output quality, FFmpeg is the right tool. It's free, open-source, and available on Windows, macOS, and Linux.

Standard GIF to MP4 Command

ffmpeg -i input.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4

The flags explained:

  • -movflags faststart — moves the MP4 metadata to the start of the file so it starts playing before fully downloaded (important for web use)
  • -pix_fmt yuv420p — ensures compatibility with iOS, QuickTime, and older devices that don't support yuv444p
  • -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" — ensures width and height are divisible by 2, which H.264 requires. Odd-dimension GIFs fail without this filter.

Controlling Quality (CRF)

Add -crf 18 for near-lossless quality (larger file) or -crf 28 for a smaller file with slight compression. The default is 23, which is a good balance:

ffmpeg -i input.gif -movflags faststart -pix_fmt yuv420p -crf 23 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4

Batch Converting All GIFs in a Folder

for f in *.gif; do ffmpeg -i "$f" -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "${f%.gif}.mp4"; done

That loop runs on macOS/Linux bash. On Windows PowerShell, use Get-ChildItem *.gif | ForEach-Object { ffmpeg -i $_.Name ... }.

Install FFmpeg: Windows — download from ffmpeg.org or winget install ffmpeg. macOS — brew install ffmpeg. Linux — sudo apt install ffmpeg or sudo dnf install ffmpeg.

6. Embedding Autoplay Looping MP4 on a Website

An MP4 with the right HTML attributes is a perfect GIF replacement on the web — silent, autoplaying, looping, and orders of magnitude smaller. The key is using all four attributes:

<video autoplay loop muted playsinline>
  <source src="animation.mp4" type="video/mp4">
  <source src="animation.webm" type="video/webm">
</video>
  • autoplay — starts playing immediately, like a GIF
  • loop — repeats endlessly without any JS
  • muted — required for autoplay to work in Chrome, Firefox, and Safari (browsers block autoplaying audio)
  • playsinline — prevents iOS Safari from opening the video fullscreen; without this, the video will not autoplay on iPhones

The <source> tags let you provide WebM as a fallback — WebM is often slightly smaller than MP4 and has universal browser support for animated content. If you only have the MP4, the single source is fine; every modern browser supports H.264 MP4.

CSS Sizing

To make the video fill its container like a responsive image:

video { width: 100%; height: auto; display: block; }

7. Platform-Specific Notes

D

Discord

MP4 autoplays inline and loops. Free accounts have 8 MB upload limit, Nitro has 25 MB. A 4 MB GIF that won't upload becomes a 200 KB MP4 that sends instantly.

X

Twitter / X

Twitter converts all uploaded GIFs to MP4 internally anyway. Upload MP4 directly for better quality control. Max 512 MB, 2 min 20 sec. 16:9 and 1:1 display best.

S

Slack

MP4 plays inline in channels. A reaction GIF that's 400 KB will typically be under 50 KB as MP4 — and looks sharper with full 16M colours.

@

Email

Keep GIF for email. Outlook shows only the first video frame; Gmail and Apple Mail have inconsistent MP4 support. GIF is the only reliable animation format for email.

W

WhatsApp

WhatsApp supports MP4 video natively and it loops on repeat. The file size reduction matters — WhatsApp has a 16 MB limit for media in most regions.

R

Reddit

Reddit converts uploaded GIFs to MP4 internally (just like Twitter). Uploading MP4 directly through Reddit's video uploader gives you control over quality before that internal conversion step.

8. What Affects Quality After Conversion

Converting from GIF to MP4 does not recover detail that was lost when the GIF was created. The MP4 encodes exactly what was in the GIF — including colour limitations. Understanding what each variable does helps you get the best result from what you have.

The 256-Colour Ceiling

The most important quality constraint: if the GIF was created from a photograph or screen recording, those millions of original colours were reduced to 256 when the GIF was made. Converting to MP4 encodes the already-limited colour data — you get 16M colour support in the container, but the actual pixel values are still the palette-limited GIF colours. To get full colour, you need the original source video, not the GIF.

Frame Rate

Most GIFs run at 10–15 fps to reduce file size. Converting to 30 fps won't add detail — the encoder interpolates the missing frames (either by repeating or blending). A frame rate of 15–24 fps usually looks natural and keeps the MP4 smaller than forcing 30 fps.

CRF (Compression Rate Factor)

In FFmpeg's H.264 encoder, CRF controls quality. Lower values = better quality and larger files. For GIF-to-MP4 conversion, CRF 18–23 is typically overkill since the source quality is already limited. CRF 23–26 produces a smaller file with no visible degradation compared to the GIF source.

Resolution

Upscaling a small GIF to a larger resolution just makes pixels bigger and more visible — it doesn't add detail. Keep the output at the GIF's original dimensions unless you specifically need a different size for a platform requirement.

9. When to Keep Using GIF

MP4 is better in almost every technical dimension, but there are two genuine use cases where GIF remains the right choice:

Email Animations

Outlook doesn't support video. Gmail and Apple Mail have partial support that you can't rely on. If you need an animation that displays in email clients your recipients actually use, GIF is the only option. The workaround for email is a static thumbnail with a play button overlaid, linking to a hosted MP4 — but if you need it to actually animate in the email body, use GIF.

Very Small Animations

A simple two-frame loading spinner or a tiny icon animation under 30 KB isn't worth converting. FFmpeg has some startup overhead per file, and the file size difference at that scale is negligible. The complexity of MP4 embedding isn't worthwhile for a 20 KB GIF.

Software Compatibility

Some older CMS platforms, email marketing tools, or corporate intranets only accept GIF for animation. If the destination software can't play MP4 in the context you need, GIF is the pragmatic choice regardless of technical merit.

Email rule of thumb: If your animation will be embedded in an email body (not linked to), keep it as a GIF. For everything else — websites, social media, Discord, Slack, WhatsApp — convert to MP4.

10. Converting MP4 Back to GIF

Sometimes you need to go the other direction — convert a video clip to GIF for email, a legacy CMS, or a meme. The size penalty is significant but avoidable with the right settings.

Use Convertlo's MP4 to GIF converter for a quick browser-based conversion. With FFmpeg, the two-pass method (generate a colour palette first, then use it) produces much better GIF quality than a single-pass conversion:

# Pass 1: generate a palette
ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png

# Pass 2: use the palette
ffmpeg -i input.mp4 -i palette.png -vf "fps=15,scale=480:-1:flags=lanczos,paletteuse" output.gif

The palettegen and paletteuse filters create a custom 256-colour palette tuned to your specific video, which dramatically reduces dithering compared to a generic palette. Lower fps=15 if you need a smaller file; raise it for smoother motion.

11. Frequently Asked Questions

Why is MP4 so much smaller than GIF?
GIF uses 30-year-old LZW compression and stores each frame as a complete image limited to 256 colours. MP4 (H.264) uses inter-frame compression — it only stores the differences between frames, not each complete frame — plus a far more efficient codec. A 5MB animated GIF typically becomes 200–400KB as an MP4 with the same visible frames and better colour accuracy.
Does converting GIF to MP4 reduce quality?
No — the converted MP4 usually looks better than the source GIF. GIF's 256-colour limit causes visible banding and dithering in images with gradients or many colours. MP4 supports 16.7 million colours (24-bit), so colours that were approximated in the GIF are now rendered properly. The one thing conversion can't do is recover colours that were lost when the original GIF was created.
Will the MP4 loop like a GIF?
The MP4 file itself doesn't loop — looping is controlled by the player or embed code. On websites, add the loop attribute to the HTML video tag: <video autoplay loop muted playsinline>. On Discord and Twitter/X, short videos loop automatically. In desktop players like VLC, enable repeat manually.
Can I use MP4 instead of GIF on websites?
Yes — a silent autoplay looping MP4 behaves identically to a GIF on all modern browsers. Use: <video autoplay loop muted playsinline><source src="animation.mp4" type="video/mp4"></video>. Google's PageSpeed Insights flags large GIFs and recommends switching to MP4 for web performance. This is the recommended approach for Core Web Vitals.
Can I use MP4 in email instead of GIF?
No — email clients don't reliably support video. Outlook shows only the first frame of a video. Gmail and Apple Mail have partial support you can't count on. For animated content in email, GIF is still the only universally supported option. Use MP4 everywhere else: websites, social media, messaging platforms.
What FFmpeg command converts GIF to MP4?
The standard command: ffmpeg -i input.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4. The scale filter ensures dimensions are divisible by 2 (required by H.264). The pix_fmt yuv420p flag ensures compatibility with iOS and older devices. Add -crf 23 to control quality (lower = better quality, larger file).
Does Twitter/X prefer GIF or MP4?
Twitter converts uploaded GIFs to MP4 internally before displaying them. Uploading MP4 directly gives you control over quality before that conversion happens. Twitter accepts MP4 files up to 512 MB with a maximum length of 2 minutes 20 seconds. For the best display quality, upload MP4 rather than GIF.
How do I convert GIF to MP4 for free?
Use Convertlo's browser-based converter — free, no upload required, FFmpeg runs locally in your browser. Other free options: FFmpeg (command-line), EZGIF.com (web-based, files uploaded to their server), or HandBrake (desktop app, good for batch conversion).
What causes GIF to have only 256 colours?
The GIF specification from 1987 supports a maximum palette of 256 colours per frame. This was a pragmatic constraint for 1980s hardware and storage. When a GIF is created from a photograph or screen recording with millions of colours, the encoder must select the 256 colours that best represent the image and approximate the rest through dithering. This is a hard limit of the format — no GIF encoder can exceed it.

GIF has survived decades beyond its technical expiry date because it works everywhere and needs no explanation. MP4 is better in every measurable way for anything that isn't email. The conversion takes two minutes. The converter is here.

Convertlo Editorial Team
We test file conversion tools, formats, and workflows so you don't have to. All guides are written from hands-on testing with real files and real tools.
More articles →