AVI to GIF

Published Updated

Choose your frame rate and target width, then convert your AVI video into a downloadable animated GIF — free, private, and processed entirely in your browser.

Can your browser play the AVI?

This converter depends on one thing: your browser must be able to decode the video inside the AVI. AVI is a container from the early 1990s, and MDN lists it among the formats that are not broadly supported by browsers (MDN, media container formats). Many AVIs hold DivX, Xvid or other codecs that browser players skip.

When the browser cannot play the file, this page shows an amber warning under the preview and suggests re-exporting to MP4 or WebM. When it can, the steps below apply.

Converting an AVI that does play

  1. Step 1

    Add an AVI and wait for the preview

    If the preview plays or shows a duration, your browser can read this AVI. If an amber warning appears, the codec is not supported.

  2. Step 2

    Pick frame rate and width

    Select the speed (5, 10 or 15 frames per second) and the width (320, 480 or 640 px). Old 640 × 480 files look fine at 480 px.

  3. Step 3

    Convert and download

    The GIF loops forever and has no sound. The result card shows how many frames and bytes you got.

What common AVI sizes turn into

Height is calculated from the source aspect ratio and rounded to a whole pixel. The width never goes above the original, so small files are not stretched.

Source sizeAt 320 pxAt 480 pxAt 640 px
640 × 480320 × 240480 × 360640 × 480
720 × 480320 × 213480 × 320640 × 427
720 × 576320 × 256480 × 384640 × 512
1280 × 720320 × 180480 × 270640 × 360

The tool takes up to 450 frames from the start, at 5, 10 or 15 fps, so a clip that fits is at most 90, 45 or 30 seconds long. All frames share one of 256 colors or fewer.

If the file will not play

  • Open it in a desktop player or converter and export H.264 video in an MP4 container, which current browsers play.
  • Keep the resolution at or below what you plan to use, since the GIF will be at most 640 px wide anyway.
  • Drop the new MP4 into Video to GIF, which accepts any video your browser can play.

A reality check on file size

An old AVI at 640 × 480 and 25 fps holds 25 frames per second, while this page keeps 5, 10 or 15. That alone removes most of the frames, so the GIF can be smaller than you expect.

What the converter does with the file

The page puts your AVI into a hidden video element and waits for the browser to report a duration. Then it asks the browser to jump to 0 s, 1/fps s, 2/fps s and so on, draws each frame onto a canvas at the chosen width, and keeps the pixels. It stops after 450 frames or at the end of the clip. All frames are quantized to one shared palette of up to 256 colors (median cut on about 20,000 sampled pixels) and written as a looping GIF with one delay value per frame.

Everything depends on the first step. An AVI file is a RIFF container that tags each stream with a four-character codec code (Microsoft AVI RIFF reference), so the container can open while the codec inside is unknown, or the browser may not read the container at all. The page cannot add a codec of its own.

Which browsers opened our test AVIs

We wrote two small AVI files with a script (no video tool was needed): one holds Motion JPEG frames, the other uncompressed 24-bit frames. We loaded both into a video element in three engines and recorded what happened.

Engine (build tested)Motion JPEG AVI, 1.69 MBUncompressed AVI, 11.5 MB
Chromium 152.0.7977.167 (desktop-app browser pane)Error code 4, "FFmpegDemuxer: open context failed"Same error
Firefox 155.0 (Playwright build)Error code 4, "Failed to init decoder"Same error
Playwright's WebKit build (user agent Version/26.6, not the Safari app)Opened: 640 x 480, 4 sError code 4

Code 4 is the MEDIA_ERR_SRC_NOT_SUPPORTED value on the MediaError interface. In Chromium the video element also reported an empty answer for video/x-msvideo in canPlayType. The same page then showed its amber warning path: the conversion routine returned its own "unsupported" error after 62 ms.

Worked example: a 4-second Motion JPEG AVI

The only engine that opened a test file was the WebKit build, so the numbers below come from there. The input is a generated clip, 640 x 480 at 25 frames per second, 100 frames, 4.0 s, 1,692,238 bytes: a smooth gradient with a moving disc and a progress bar. This page's own tool converted the clip at each of the nine settings. Smooth gradients are hard on a 256-color palette without dithering, so this clip gives large GIFs. A flat screen recording would give smaller ones.

Frame rateFrames320 px wide (320 x 240)480 px wide (480 x 360)640 px wide (640 x 480)
5 fps20326,684 B537,678 B784,078 B
10 fps40657,914 B1,081,435 B1,585,721 B
15 fps60975,085 B1,589,640 B2,371,168 B

Two things stand out. The 640 px, 10 fps GIF is 1.6 MB against 1.7 MB for the AVI, even though it holds 40 of the 100 frames, because every frame is stored whole. And 15 fps does not give 4.0 s: the delay is stored in hundredths of a second (GIF89a specification), 1/15 s becomes 7, and the 60 frames play for 4.2 s. In the file, the 5 fps delays read 20 and the 10 fps delays read 10.

Two passes over the nine settings gave byte-identical GIFs. The tool waits for the browser to present each frame, up to a short time limit, and none of the nine GIFs had a transparent pixel in any frame.

Limits that come from the code

  • Frames are held in memory as raw pixels until the file is written. At 640 x 480 the cap of 450 frames is 553 million bytes (450 x 640 x 480 x 4), which is more than a low-end phone may allow.
  • A seek that never finishes is abandoned after 3 seconds and whatever is on screen is drawn, so a slow file can repeat a frame.
  • Width is never enlarged. A 352 x 288 AVI stays 352 wide at the 480 and 640 settings.
  • The result does not depend on the AVI's frame rate. A 25 fps file and a 30 fps file give the same frame count at the same setting, because frames are picked by time.

AVI to GIF questions

Why does it say my browser cannot play this AVI?

AVI is only a container, and desktop browsers support few of the codecs commonly stored in it. DivX, Xvid and many older camcorder codecs are not decoded by the built-in players. The amber warning reports exactly that, so the page does not fail silently.

How do I convert a DivX or Xvid AVI to GIF?

Re-encode it to H.264 MP4 first in a desktop player or converter such as VLC or HandBrake, then drop the MP4 into the Video to GIF page. This page cannot decode those codecs, and neither can the other video tools on this site.

What sizes does a 640 × 480 AVI produce?

320 × 240, 480 × 360 or 640 × 480 depending on the width option. A 720 × 480 file gives 320 × 213, 480 × 320 or 640 × 427, because height is rounded to whole pixels.

How long can the clip be?

A GIF here holds at most 450 frames, taken from the start of the file. A 90-second clip at 5 fps uses exactly that budget, and a 60-second clip at 10 fps is cut off after 45 seconds.

Will the soundtrack come along?

No. GIF has no audio, so only the picture is written.

Does the amber warning mean my AVI is damaged?

Not necessarily. In our test two valid AVIs, one with Motion JPEG and one uncompressed, failed in Chromium 152 and Firefox 155, and the Chromium message named the container reader, not the video. The warning means the browser could not open the file, whatever the reason.

Why can the GIF be bigger than my AVI?

A GIF stores each kept frame whole. In the WebKit build, a 1.69 MB Motion JPEG AVI became a 1.59 MB GIF at 640 px and 10 fps with only 40 of 100 frames, and 2.37 MB at 15 fps. Results depend on the picture, and a smooth gradient is a hard case.

Why does a 15 fps GIF play slower than the clip?

GIF delays are whole hundredths of a second, so 1/15 s is stored as 7: 60 frames at 15 fps played for 4.2 s, from a clip that was 4.0 s long.

Related guide

Making a GIF from a video: size, frame rate and quality. The guide covers the GIF side of the conversion: palette, frame delays and size, once the browser can decode the AVI.

Related Tools