ConvertBox Logo
ConvertBox

Video to GIF: why GIFs are huge and how to keep them small

A GIF stores nearly every frame as a 256-colour picture with weak compression, so its size is roughly pixels per frame times number of frames. Shorten the clip first, then reduce width and frame rate, and use video instead wherever the destination accepts it.

ConvertBoxPublished

Why a GIF outweighs the video it came from

GIF was designed in 1987 for simple graphics, and its animation is little more than a stack of still images. Each frame is a grid of pixels in which every pixel is an index into a palette of at most 256 colours, and the grid is compressed with LZW, a lossless method that looks for repeated sequences of pixel values. It has no notion of motion.

Video codecs such as H.264 work the other way round. They store an occasional full frame and describe the frames in between as movements and small corrections of what is already on screen, then discard detail the eye will not miss. A GIF frame may be limited to the rectangle that changed and may mark unchanged pixels as transparent, which helps a screen recording where only a cursor moves. With camera footage nearly every pixel changes in every frame, so the GIF ends up storing close to a full picture each time. It also carries no sound.

Worked numbers: pixels times frames

A rough size estimate needs only multiplication. Before compression, each pixel of each frame costs one byte. A 480 Γ— 270 frame has 129,600 pixels, about 130 KB. Five seconds at 10 frames per second is 50 frames, so the raw data is about 6.5 MB. LZW then removes some of it: a lot for flat-coloured interface recordings, very little for grainy or dithered footage. For comparison, five seconds of H.264 at 1 Mbps is about 0.6 MB, in full colour.

Now raise both settings. At 720 Γ— 405 there are 291,600 pixels per frame, 2.25 times as many, and 30 frames per second triples the frame count. The two multiply: 150 frames Γ— 292 KB is about 44 MB of raw data for the same five seconds, 6.75 times the first figure. Doubling the duration doubles it again. This is why GIFs that look modest on screen run to tens of megabytes.

The three levers: duration, width and frame rate

Every lever acts on the product of frames and pixels, so the table in this section gives the raw data that remains after each change. Width counts twice, because the height shrinks with it.

ConvertBox's Video to GIF tool exposes exactly two of these: frame rate from 5 to 30 fps in steps of 5 (default 10) and width from 240 to 720 px in steps of 120 (default 480), with the height following the aspect ratio and frames resized by Lanczos filtering, which keeps edges crisp. Duration is not adjustable there; the whole video is converted. One quirk of the format is worth knowing: GIF stores frame delays in hundredths of a second, so 10, 20 and 25 fps are exact while 15 and 30 fps can only be approximated.

ChangeRaw data that remainsWhat you give up
Duration 10 s to 5 s50%Half the content, nothing in quality
Width 720 px to 480 px44%Fine detail; small text may blur
Width 480 px to 240 px25%Most detail; suitable for stickers and thumbnails
Frame rate 30 fps to 15 fps50%Fast motion looks less fluid
Frame rate 30 fps to 10 fps33%Visibly stepped motion; fine for demos

Banding and dithering: the cost of 256 colours

A video frame can contain millions of distinct colours; a GIF frame gets 256. Where the source has a smooth gradient, such as a sky, a skin tone or a dimly lit wall, neighbouring shades collapse into the same palette entry and the gradient breaks into visible stripes. This is banding.

Dithering hides it by scattering pixels of two available colours so that their mix approximates the missing one. The stripes turn into a fine grain, which usually looks better, but the grain is noise, and noise is exactly what LZW cannot compress, so dithered GIFs are larger. Which 256 colours are available matters just as much. Dedicated GIF software analyses the clip first and builds a palette tailored to it, the two-pass technique available in FFmpeg through its palettegen and paletteuse filters, and on photographic footage the improvement is large.

The Video to GIF tool runs a single pass through FFmpeg's GIF encoder and does not build a palette for the clip. Flat-coloured material such as interfaces, diagrams and cartoons converts cleanly; skies, skin and dark scenes tend to show banding or speckle, and no setting on the page changes that. For such footage a two-pass palette workflow in desktop software gives a visibly better result.

When a short MP4 or WebM is the better choice

Much of what is called a GIF today is not one. Many social platforms and messaging apps convert uploaded GIFs to video for delivery, and the clips in GIF pickers are generally served as short looping videos, because the same animation as H.264 or VP9 is a fraction of the size, in full colour. On a web page of your own, a video element set to autoplay, loop and stay muted behaves like a GIF while downloading far less.

So ask what the destination accepts. If it takes video, a short muted MP4 is smaller and looks better; trim it and, if needed, compress it. GIF earns its place where video is not allowed or will not play inline: README files, the body of an email, some forums and chat stickers.

A workflow that keeps the GIF small

  • Cut the clip to the few seconds that carry the point before converting. The Video to GIF tool has no start or end selector and accepts sources up to 100 MB, so trim first with a video trimmer; long conversions are also memory-hungry.
  • Start at 480 px and 10 fps. For a software demo keep the width at 480 to 600 px so text stays readable; for a reaction clip use 360 to 480 px at 15 fps; for a sticker, 240 px.
  • If the result is too large, lower the width first when the content is motion, and the frame rate first when the content is text that must stay sharp.
  • Use 20 fps or more only for fast motion, and keep such clips very short.
  • Prefer sources with flat colour and a steady camera. A static background compresses well, while handheld footage changes every pixel in every frame.

Tools mentioned in this guide

Related guides

All guides