On-device AI — professional-grade, fully private.

Video

How to Turn a Video Into a GIF That Is Not 40MB

GIF is a 1987 format with a 256-colour limit and no compression to speak of. Here is how to work within it — and when to use an animated WebP instead.

Updated August 11, 20265 min read

GIF is nearly forty years old, limited to 256 colours per frame, and has only basic inter-frame compression: a frame can redraw just the region that changed, but there is nothing like a video codec's motion prediction. It survives because it plays automatically everywhere without a video player, which is exactly what a reaction image, a bug report or a product demo in a README needs. Working with it well means accepting its constraints rather than fighting them — and knowing the three settings that decide whether your GIF is 2MB or 40MB.

Why GIFs get so large

Modern video codecs store one full frame and then describe only what changed in the frames after it. That is why a ten-second video of a mostly static scene can be under a megabyte. GIF has only a crude version of this: a frame can redraw just the rectangle that changed and leave the rest of the previous frame in place, which is why static screen recordings optimise well. In camera footage, though, nearly every pixel changes from frame to frame, so each frame is stored close to in full and file size scales roughly linearly with the number of frames.

That single fact drives every optimisation. A 10-second GIF at 30fps is 300 near-complete images. Cut it to 4 seconds at 12fps and you have 48 — six times smaller before you have touched anything else. Duration and frame rate are the dominant levers by a wide margin.

The three settings that matter

SettingRecommendedEffect on size
Duration2–6 secondsLinear — half the length is half the file
Frame rate10–15fpsLinear — 15fps is half of 30fps
Width480–640pxQuadratic — halving the width quarters the pixels

Width is the one people underestimate. Because it affects both dimensions, dropping from 1280px to 640px removes 75% of the pixels in every frame. On a GIF embedded in a chat message or a documentation page, 640px is already larger than it will be displayed.

The 256-colour problem

Each GIF frame can use at most 256 distinct colours. A video frame typically contains tens of thousands. The encoder has to pick a palette and approximate everything else, usually by dithering — scattering pixels of available colours to fake the missing ones.

This is why certain footage turns to noise. Sunsets, skin tones, smoke, and any smooth gradient become visibly banded or speckled. Meanwhile flat-coloured content — screen recordings, UI demos, animation, anything with large uniform areas — converts beautifully, because it never needed many colours to begin with.

Practical consequence: screen recordings are the ideal GIF material and sunsets are the worst. If your source is photographic and full of gradients, either accept the banding or use a different format.

The workflow

1

Trim ruthlessly first

Find the two to five seconds that carry the point and cut everything else with the video cutter. This is the single largest saving available and it costs nothing.

2

Crop out dead space

A screen recording of one dialog box does not need the whole desktop around it. The video cropper removes pixels that were never carrying information.

3

Convert with a low frame rate

In the video to GIF converter, set 10–15fps and a width around 600px. Watch the size estimate move as you adjust — it is far quicker than exporting and checking.

4

Check it at display size

A GIF that looks fine at 100% may band badly when scaled. View it at the size it will actually appear before you post it.

Trim, set the frame rate, and export — all on your device, with no upload and no watermark.

Convert a video to GIF

When not to use GIF

GIF is often the wrong tool and gets used out of habit. Two alternatives are usually better:

  • Animated WebP — same autoplay-anywhere behaviour in modern browsers, full colour instead of 256, and in Google's own tests 64% smaller than the same GIF when saved lossy (19% smaller when lossless). If you control the page, this is strictly better. Every current browser supports it.
  • A muted, looping MP4 — the smallest option by a wide margin. A 10-second clip that would be a 25MB GIF is often under 1MB as video. Most social platforms already do this silently: upload a GIF to X and it is converted to video behind the scenes, and the GIFs in most chat pickers are really MP4s.

Use actual GIF when the destination genuinely requires it: email signatures, older forums, some documentation renderers, and chat platforms that will not autoplay video. For everything else the alternatives win on both quality and size.

Making GIFs from still images

Not every GIF starts as video. Before-and-after comparisons, step-by-step UI sequences and simple animations are often better assembled from stills, where you control each frame exactly and can hold the important ones longer. The GIF maker takes a set of images and a per-frame duration.

This approach produces dramatically smaller files for tutorial content, because you might use eight frames where a screen recording would have used a hundred and twenty — and the eight are the only ones a reader actually needs to see.

One last habit: keep the source video. A GIF is a lossy dead end — you cannot recover colour depth or frames from it later. When you need a different size or a longer version, going back to the original takes a minute; rebuilding from the GIF is not possible.

Frequently asked questions

Why is my GIF so large?

Because for camera footage GIF stores each frame almost in full — its only inter-frame trick is redrawing the region that changed — so size scales with frame count. A 10-second 30fps GIF holds 300 near-complete images. Cutting the duration, dropping to 10–15fps and reducing the width to around 600px routinely takes a 30MB GIF under 3MB.

What is the best frame rate for a GIF?

10–15fps for most content. It reads as smooth for UI demos, reactions and screen recordings while halving the size compared with 30fps. Go higher only for fast motion where the stutter would be distracting.

Is WebP better than GIF?

For quality and size, clearly — animated WebP supports full colour instead of 256 and, in Google's tests, comes out 64% smaller than the GIF when lossy and 19% smaller when lossless, with support in every current browser. GIF still wins on universal compatibility with older software, email clients and some forums.

How long can a GIF be?

There is no format limit, but practicality caps it around 5–10 seconds. Beyond that the file grows past what most platforms accept, and viewers rarely watch a silent loop for longer. If you need more, use video.

Keep reading

More in Video →