Lottie vs GIF vs MP4: which animation format should you use?

Lottie, GIF, and MP4 can all show a moving picture on a web page, and that is about where the similarity ends. They differ in file size, transparency, sharpness on high-DPI screens, interactivity, and playback control. Picking the wrong one costs you megabytes of bandwidth, a blurry hero section, or an animation you cannot pause. This article compares the three honestly, so you can choose by the job, not by habit.

The short answer

Use Lottie for interface animation — icons, loaders, success states, onboarding illustrations, and anything you want to start, stop, or scrub programmatically. Use GIF when you need a dead-simple, universally supported looping clip and file size does not matter much, such as a short reaction image in a chat or a forum. Use MP4 (or WebM) for photo-real or heavily textured motion — product demos, cinematic hero videos, and anything that is essentially a short film.

File size

This is where the formats diverge most dramatically. A Lottie animation is mostly a text description of shapes and motion: a vector logo morph or a UI illustration is typically measured in kilobytes. The same animation as a GIF is usually measured in megabytes, because GIF stores a full raster image for every frame and its 1987-era compression cannot do much about it.

MP4 is the efficiency champion for raster content. Modern video codecs exploit the fact that consecutive frames are mostly identical, so a short photo-real clip can be surprisingly small. But the comparison is only fair when the content is the same. A vector-style illustration rendered as MP4 is still a raster video: it carries a pixel grid for every frame, while Lottie carries a handful of bezier curves. For illustration-style motion, Lottie is typically the smallest option by a wide margin. For photo-real motion, MP4 wins.

One caveat: Lottie files with embedded raster frames break this rule. If an After Effects composition was exported with PNG sequences baked in, the Lottie file can be tens of megabytes — the worst of both worlds. Read why your Lottie file is 70 MB for the full explanation, and run the result through the lottie-mini compressor, which re-encodes those frames to WebP and can cut the file down dramatically.

Transparency and alpha

Lottie supports full alpha transparency, including soft edges, gradients, and partial opacity — it is just vector shapes drawn on a transparent canvas. This is what makes Lottie ideal for overlaying an animation on top of your page background, a button, or a photo.

GIF supports transparency too, but only in the crudest form: each pixel is either fully opaque or fully transparent. That is why GIFs with transparent backgrounds often show a jagged, haloed edge — there is no anti-aliasing against the background.

MP4 has no alpha channel at all in its common H.264 form. A video always fills a rectangle. You can work around this with WebM/VP9 or a green-screen keying trick, but neither is as clean or as widely supported as Lottie’s native transparency.

Scalability and sharpness

Lottie is resolution-independent. It is drawn from vectors at render time, so the same file looks crisp on a 1x phone screen, a 2x laptop, and a 4K monitor. GIF and MP4 are raster: they have a fixed pixel size, and scaling them up reveals blur or blockiness. If you need one asset that works everywhere, Lottie is the only format of the three that guarantees it.

Interactivity and playback control

This is Lottie’s decisive advantage. A Lottie animation is a programmatic object: you can play, pause, loop a segment, jump to a frame, change speed, reverse direction, swap colors, or bind progress to scroll position or a slider. A loading spinner can become a progress indicator; a button animation can respond to hover; a scroll-driven illustration can play forward and backward with the page.

GIF offers almost nothing here: it loops, and that is it. You cannot pause it reliably, seek to a frame, or change its speed from JavaScript. MP4 gives you the standard video controls — play, pause, seek, playback rate — but you cannot reach inside the animation and change a color, swap a label, or react to an event frame by frame.

If your animation is meant to react to the user, the choice is already made. See how to embed Lottie in React for the practical code, and how the lottie-mini compressor works for how the file itself is structured.

Browser support

GIF and MP4 work everywhere with zero JavaScript — an <img> tag and a <video> tag, respectively. Lottie needs a player library such as lottie-web, which adds a runtime dependency (roughly a hundred kilobytes, typically loaded once and cached). That is a real cost, and for a single tiny animation on an otherwise static page it can outweigh the file-size saving.

In practice, most sites already ship JavaScript, and the player cost is amortized across every animation on the page. But if you are building a zero-JS email template or a page where every kilobyte of script matters, a GIF or a video may be the pragmatic choice.

Decision table

CriterionLottieGIFMP4
File size (vector-style art)Smallest, typically KBsLargest, often MBsMedium
File size (photo-real video)Not suitableVery largeSmallest
TransparencyFull alpha, soft edges1-bit, hard edgesNone (H.264)
ScalabilityVector, infinitely sharpFixed pixels, blurs when scaledFixed pixels, blurs when scaled
Playback controlFull: play, pause, seek, speed, segmentsLoop onlyStandard video controls
InteractivityYes: events, dynamic colors, scroll bindingNoNo
Needs a JS playerYesNoNo

When to use each

  • Lottie: UI micro-interactions, loaders, empty states, success checkmarks, onboarding illustrations, animated logos, scroll-driven storytelling, and anything that must stay sharp on every screen and respond to user input.
  • GIF: short looping clips shared in chat, forums, or email, where the audience may not run JavaScript and the clip is small enough that the file size does not hurt. Also useful as a fallback when a Lottie player cannot be loaded.
  • MP4: photo-real motion, screen recordings, product demos, cinematic hero videos, and any animation that is really a video — every frame a fully different rendered scene with no shared geometry.

Summary

Lottie is the format for animation that behaves like software: small, sharp, transparent, and controllable. GIF is the format for animation that behaves like an image: simple and universal, but heavy and dumb. MP4 is the format for animation that behaves like video: efficient for photographic motion, but a sealed rectangle you cannot reach into. Most modern products end up using Lottie for the interface and MP4 for the showreel — and keeping GIF for the group chat.