Skip to content

Convert a GIF to MP4 in your browser

Turn an animated GIF into an H.264 MP4 that every phone, player and social network accepts, at a fraction of the size. The conversion runs on this page with ffmpeg compiled to WebAssembly: choose the quality, how many times the animation plays, and what transparent pixels become.

  • H.264 in an MP4 that plays everywhere
  • Usually a tenth of the GIF’s size
  • Repeat the loop up to four times
  • White or black behind transparency
  • Nothing is uploaded

How it works

  1. Step 1

    Choose the GIF: drop it on the box above or click to pick it. Up to 100 MB; the work happens in your browser’s memory.

  2. Step 2

    Pick a quality, decide whether the loop should repeat, and choose the colour behind transparent pixels if the GIF has any. Press Convert to MP4.

  3. Step 3

    The first conversion loads the converter, about 30 MB, which your browser keeps. Then the MP4 encodes, plays in the preview, and downloads with one click.

The MP4 you get, and the settings behind it

Quality
H.264 with a constant rate factor: High is CRF 18, visually the same as the GIF; Balanced is CRF 23, x264’s own default and the usual choice for the web; Smallest file is CRF 28, softer on fine detail and noticeably smaller. The preset is veryfast, which keeps the conversion quick on a laptop.
Play the animation
A GIF loops forever; an MP4 plays once unless the player loops it. Repeating the animation two, three or four times inside the file gives a longer clip for places that play video once, like a message or a slide.
Transparent areas
MP4 has no transparency. Transparent pixels in the GIF are laid over white or black before encoding, so the result matches the page or deck it will sit on.
Frame size
Kept, rounded down to even numbers. H.264 in the yuv420p pixel format every player understands needs even dimensions, so a 301 pixel wide GIF becomes a 300 pixel wide video.
Timing
Each GIF frame is shown for its own delay, so a GIF with uneven timing keeps it. The MP4 is written with faststart, which puts the index at the front so playback starts before the download ends.

Why the MP4 is so much smaller

A GIF stores every frame as a separate palette image. H.264 stores most frames as the difference from the frames around them, with motion compensation, and keeps full 24 bit colour while doing it. A 10 MB GIF commonly becomes an MP4 under 1 MB that looks better than the original, because the 256 colour palette and dithering are gone.

Where GIFs fail and MP4 works

Social networks convert GIFs to video on upload anyway; messaging apps cap GIF sizes; decks, video editors and digital signage players want a real video track. An MP4 with H.264 and yuv420p is the file every one of them accepts, from iPhones to PowerPoint to the browser <video> element.

Keeping the GIF feel on a web page

A GIF autoplays, loops and never shows controls. The same page behaviour with an MP4 is a <video> element with the autoplay, muted, loop and playsinline attributes, which browsers play without a tap, at a fraction of the download.

Frequently asked questions

Does the GIF get uploaded to a server?
No. ffmpeg runs on this page as WebAssembly, in a web worker in your browser. The GIF is read into memory, converted there, and the MP4 is offered as a download. Close the tab and nothing of it remains anywhere.
Why does the first conversion take longer?
The converter itself is about 30 MB and is downloaded with the first conversion, then kept in your browser’s cache. Later conversions start at once. The encoding then runs at roughly the speed of a native ffmpeg divided by five to ten, so a 10 second GIF takes a few seconds.
Will the MP4 loop like the GIF did?
Whether a video loops is up to the player, not the file. For a page, give the <video> element the loop attribute. For places that play a clip once, choose to repeat the animation two to four times inside the file instead.
Does the MP4 have sound?
No. A GIF has no audio, so the MP4 gets a video track only. Players treat a file without an audio track as a silent video, which is also what autoplay rules want.
Can I convert an MP4 back to a GIF here?
Not on this page; it goes one way, from GIF to MP4. If the animation started as HTML, a CSS or GSAP animation or an HTML5 banner, the recorder makes the GIF directly from the source, at the size and frame rate you choose, instead of a video of a GIF of it.
What about WebM, APNG or a very large GIF?
WebM has its own converter. APNG is not supported here. A GIF up to 100 MB converts; above that a browser tab tends to run out of memory, so cut the GIF or scale it down first, for instance with the GIF compressor.

Did the GIF start life as HTML?

An HTML5 banner, a CSS or GSAP animation, a CodePen or a Claude artifact records straight to MP4 with RecordHTML: a real Chrome browser, exact sizes and frame rates, and no GIF in between.

10 credits free every month · No card needed

Related