FLXCode GIF to MP4

FLXCode apps

Appearance

GIF to MP4

Pick a GIF, get an MP4 that is usually many times smaller. Your browser does the work and the file stays on your device.

or drop one here

One animated GIF, up to 100 MB.

No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.

Problem or idea? Email us

Quick start

  1. Choose a GIF or drop it in. The preview plays it.
  2. Pick the output size. Original keeps the full size; smaller widths make a smaller file.
  3. Set how many times the clip plays. An MP4 does not repeat on its own, so a loop is written into the file.
  4. If the GIF has see-through parts, pick the background color they get.
  5. Press Make MP4, check the preview and download it.

Why an MP4 is smaller than a GIF

A GIF keeps every frame as a full picture, with at most 256 colors, and packs each one on its own. An MP4 stores a frame, then mostly what changed since the last one, and it may drop detail the eye does not miss. Photos and screen recordings shrink a lot. A tiny flat animation shrinks less.

An MP4 has no repeat flag. A GIF can say "play forever", a plain MP4 cannot. Players, Twitter/X and Discord loop short clips by themselves, and you can set the plays here for places that do not.

Twitter/X and Discord take MP4 files with H.264 video. A short MP4 posted there plays like a GIF, and it loads faster.

Sizes for the same animation

The test animation is a moving square on a gradient, made by this page's own code. The GIF is written with 256 colors and dithering, and its size is computed when the page is built. The MP4 size is measured in Chromium with the Balanced setting, by the page's own test, and rounded.

Test animationGIFMP4MP4 is smaller by
160 x 120 px, 20 frames243 KBabout 21 KBabout 12 times
320 x 240 px, 20 frames691 KBabout 26 KBabout 26 times
480 x 360 px, 20 frames1.27 MBabout 44 KBabout 29 times

This test animation has smooth gradients, which a GIF handles badly, so it shows a large gap. A small flat animation with few colors shrinks less. Your own file is shown before and after on the page, so you see the real number.

Odd sizes lose one pixel: 401 x 300 px becomes 400 x 300 px; 640 x 481 px becomes 640 x 480 px; 480 x 270 px becomes 480 x 270 px.

Timing follows the GIF. Delays of 100, 100, 250 and 30 ms start at 0 ms, 100 ms, 200 ms, 450 ms. Three frames played three times are the frame order 1, 2, 3, 1, 2, 3, 1, 2, 3.

How it works

The page reads your GIF frame by frame and puts each frame on a canvas, over the background color. The browser's WebCodecs encoder turns the canvas pictures into H.264, and a small library (mp4-muxer) packs them into an MP4 file with the info at the front, so it can start playing before it is fully loaded.

Each frame is shown as long as the GIF says. Many GIFs use 0 or 10 ms, which browsers play at 100 ms, and this page does the same, with 20 ms as the shortest. The clip is encoded once. Extra plays reuse the same encoded data with later times, so 10 plays do not take 10 times as long.

If the browser has no H.264 encoder, the page says so and writes a WebM file instead, with VP9 or VP8.

Numbers this uses

  • Frame times come from the GIF delays, 20 ms at the least (browsers play 0 and 10 ms at 100 ms).
  • Sides are rounded down to even numbers, because H.264 stores pictures in pairs of pixels. At most 1 px is cut.
  • Bit rate is about 0.05 (smaller file), 0.1 (balanced) or 0.2 (sharper) bit per pixel per frame, from 100 kbit/s to 8 Mbit/s. At 10 frames per second, Balanced means 100 kbit/s for 160 x 120 px, 173 kbit/s for 480 x 360 px, 922 kbit/s for 1280 x 720 px.
  • Plays in a row: 1 to 10. Output: up to 3000 frames in all.
  • GIF input: up to 100 MB, 4096 px on a side and about 800 MB of memory for the decoded frames.
  • Codec: H.264 at the level the size needs (3.1 up to 1280 x 720, 4.0, 5.1 and 6.0 above that).

Limits

  • MP4 has no transparency. See-through pixels get the background color.
  • The video has no sound, because a GIF has none.
  • MP4 is lossy. Fine one-pixel lines and hard text edges can soften at the smaller-file setting.
  • Phones and older browsers may lack an encoder. The page tells you before you pick a file.

Privacy

Nothing you choose is uploaded or stored. The code that reads GIFs and writes video comes from this site and runs in your browser. We count events without cookies, such as "video saved" (details).

FAQ

How do I convert a GIF to MP4?

Choose the GIF, pick an output size, set how many times it should play and press Make MP4. Your browser encodes the video with H.264 and you download the file. Nothing is uploaded.

Why is the MP4 so much smaller than the GIF?

A GIF stores every frame as a whole picture with at most 256 colors. A video stores the first picture, then mostly the changes between frames, and it compresses them with a lossy codec. For the same clip that is often 5 to 20 times less data.

Will the MP4 loop like my GIF did?

Not by itself. An MP4 has no repeat setting. This page writes the clip several times in a row (1 to 10 plays), and most players and apps let you turn on loop for the file as well. Twitter/X and Discord loop short videos on their own.

Can I post the MP4 on Twitter/X or Discord?

Yes. Both accept MP4 with H.264 video, and a short MP4 plays like a GIF there. Check each service for its current file size and length limits, which change from time to time.

What happens to transparent parts of my GIF?

MP4 has no transparency. Transparent pixels are painted with the background color you choose, white at first. If the GIF will sit on a dark page, pick a dark color.

Why did my GIF lose a pixel row or column?

H.264 needs a width and a height that are even numbers. A GIF that is 401 px wide is written 400 px wide. The page shows the exact output size before you start.

It says my browser cannot make MP4. What now?

Some browsers, such as Firefox on some systems and Chromium builds without proprietary codecs, have no H.264 encoder. The page then offers a WebM file, which most sites and apps accept. Chrome, Edge and Safari on a computer normally make MP4.

Is my GIF uploaded anywhere?

No. The file is read, drawn and encoded by your browser on this device. It is not sent, stored or put in the address bar. To check, load the page, turn on airplane mode and convert a GIF.

More from FLXCode

Share GIF to MP4