How to convert a GIF to MP4

To convert a GIF to MP4, decode every frame of the GIF and encode the frames as an H.264 video, each with its original duration. The converter on this page does that in your browser: drop the GIF, keep MP4 selected and download the video. A GIF made from a video clip often shrinks to a small fraction of its size, and nothing is uploaded.

5 min read

The quick way

Drop your animated GIF on the converter below. MP4 is already selected, so the conversion starts right away and the row shows the progress. When it is done, the row tells you the size of the video, its length and the number of frames, and how much smaller it is than the GIF. Click Download, or Download all as ZIP if you added several GIFs.

Two settings are worth a look before you download. Repeat puts the animation into the video several times, which helps where the player does not loop videos on its own. Background is the color used for transparent parts of the GIF, because MP4 cannot store transparency; pick the color of the page or slide where the video will be shown.

Try it here: GIF to MP4

Open the full tool page

Why GIFs are so big

GIF was designed in 1987 for still images and simple graphics. Each frame is a picture of at most 256 colors, compressed with LZW, a lossless method that works well on flat areas and badly on anything with noise or gradients. An animation is just a list of these pictures. The best a GIF encoder can do is store only the rectangle that changed and mark unchanged pixels as transparent.

Video is different. When a GIF is made from a video clip, the clip has millions of colors, so the GIF encoder has to dither: it scatters pixels of the available colors to fake the missing ones. That noise changes from frame to frame and is almost impossible for LZW to compress, which is why a three second clip can weigh several megabytes.

A video codec such as H.264 is built for exactly this content. It predicts each frame from the previous one using motion vectors, stores only the difference, throws away detail the eye does not notice and keeps full color. The result is a file that looks smoother than the GIF and is usually far smaller.

  • GIF: 256 colors per frame, lossless LZW, no motion prediction
  • MP4 (H.264): full color, motion prediction between frames, adjustable quality
  • WebM (VP9 or VP8): similar to MP4, made for web pages

How much smaller? Our measurements

We converted three kinds of GIF with the converter on this page in Microsoft Edge on Windows, using the default settings. The numbers show both sides of the story: GIFs made from photos or video shrink dramatically, while a small screen recording with few colors was already compact as a GIF.

Results depend on your browser, because the video encoder is part of the browser. In our tests MP4 was often smaller than WebM, even though VP9 is the more modern codec on paper.

GIFSize and lengthGIF fileMP4WebM
Photo-like clip, dithered, 256 colors480 x 270, 48 frames, 2.9 s4.5 MB187 KB1,004 KB
Simple drawn animation400 x 260, 16 frames, 1.8 s17 KB6.8 KB13 KB
Screen recording, 64 colors640 x 400, 40 frames, 4 s27 KB43 KB65 KB

What changes when a GIF becomes a video

Timing stays the same. Every frame is encoded with its own duration, so a GIF that pauses on its last frame for two seconds does the same as an MP4. Frames that the GIF marks with no delay at all play for 0.1 seconds, which is what browsers do with the GIF too.

Looping is no longer part of the file. A GIF carries its own loop setting, an MP4 plays once and the player decides whether to repeat it. Web pages, most social networks and many chat apps loop short videos anyway. For everything else, use Repeat to place the animation in the video 2, 3, 5 or 10 times.

Transparency is lost. MP4 and WebM videos made here are fully opaque, so transparent pixels get the background color you choose. If the GIF sits on a white page, white is right; on a dark slide, choose the slide color.

Size can change by a pixel. H.264 needs even width and height, so a GIF that is 375 pixels wide gets one extra column that repeats the edge pixels. Very small GIFs, under 32 pixels on a side, are enlarged by a whole factor because video encoders do not accept such tiny frames, and the pixels stay sharp. The video has no sound, just like the GIF.

Using the MP4 where you used the GIF

On a web page, a video with the attributes autoplay, loop, muted and playsinline behaves like a GIF: it starts by itself, repeats and shows inline on phones. Browsers only autoplay muted videos, which is not a problem here because the video has no sound. Swapping large GIFs for such videos is one of the simplest ways to improve page speed scores.

In PowerPoint, insert the MP4 with Insert, Video and turn on Loop until Stopped on the Playback tab. Social networks and messengers accept MP4 almost everywhere, often with higher size limits than for GIFs, and many of them turn uploaded GIFs into video themselves anyway.

If a platform only takes GIFs, you can go the other way: the Video to GIF tool turns an MP4 back into a GIF with a palette built from the clip.

When to keep the GIF

Email is the main case. Most email programs show animated GIFs but do not play videos inside the message, so newsletters still use GIFs. Some forums, older content systems and chat apps also accept images but not videos.

Small graphics with a few flat colors, such as animated icons, loaders or simple screen recordings, are often already small as GIFs, and the video may come out larger, as our measurements show. And if you need transparency, keep the GIF or convert it to animated WebP with the image converter, which keeps transparent pixels.

Step by step

  1. Add the GIFDrop one or more animated GIFs on the converter or choose them from your device.
  2. Keep MP4 selectedMP4 plays everywhere. Choose WebM only if your website serves WebM videos.
  3. Set Repeat and BackgroundRepeat the animation if the player will not loop it, and pick a background color for transparent parts.
  4. Download the videoClick Download for each video, or Download all as ZIP for several at once.

Frequently asked questions

Does converting a GIF to MP4 lose quality?

Hardly any that you can see. The video encoder smooths the dithering noise of the GIF slightly, but it has full color, so gradients and photos often look better than in the GIF.

Why does my MP4 not loop?

An MP4 file does not contain a loop setting; the player decides. Turn on looping in the player, use the loop attribute on a web page, or set Repeat so the animation plays several times inside the video.

Why is my MP4 bigger than the GIF?

This happens with small GIFs that have only a few flat colors, such as icons or simple screen recordings. GIF compresses such images well, so there is little to gain. Keep the GIF in that case.

Can I convert several GIFs at once?

Yes. Add as many GIFs as you like. They are converted one after another and you can download them all in one ZIP file.

Are my GIFs uploaded?

No. The GIF is decoded and the video is encoded in your browser on your own device, so the files never leave it.