GIF is a 1987 palette-based image format whose animation use case is now served far better by AVIF or video. CompuServe released it on 15 June 1987 to move colour images across slow dial-up links. Its 256-colour ceiling and 1-bit transparency made sense then and constrain it now. This page explains how GIF stores pixels, why animated GIFs are so large, and why animated AVIF (or an MP4/WebM video) usually cuts the bytes by 80–90% or more.
There is no GIF converter on this site, because GIF is rarely the right target. Convert to AVIF instead: Convert JPG to AVIF, Convert PNG to AVIF.
What GIF is
GIF stores an image as indexed pixels that point into a colour palette of at most 256 entries. The acronym expands to Graphics Interchange Format. Three facts fix its design:
- A GIF references a palette of up to 256 colours, each chosen from the 24-bit RGB space.
- The format compresses pixel runs with LZW, a lossless dictionary algorithm.
- A single file holds multiple frames, which is how GIF animates.
The MIME type is image/gif. The original 87a version handled still images; the 89a revision (1989) added animation timing, a transparent colour, and metadata. See the GIF specification history on Wikipedia for the full timeline.
The 256-colour limit
GIF can show no more than 256 distinct colours in one frame. This is the format's defining constraint. Photographs contain thousands of colours, so encoding a photo as GIF forces quantisation and dithering. The result shows visible banding, speckled dither patterns, and posterised gradients.
Modern formats remove the ceiling entirely:
- AVIF carries 10-bit and 12-bit colour, billions of tones.
- PNG carries full 24-bit colour for lossless graphics.
- WebP carries 24-bit colour in both lossy and lossless modes.
Animated GIFs can assign each frame its own 256-colour palette, which softens the limit slightly. The cost is more palette data and larger files. For colour-rich content, GIF is the wrong format.
The 1-bit transparency limit
GIF transparency is binary: a pixel is either fully opaque or fully transparent. There is no partial alpha and no anti-aliasing across the alpha boundary. A curved GIF logo placed on a coloured background shows jagged, stair-stepped edges where the cutout meets the page.
PNG solved this in 1996 with 8-bit alpha. AVIF and WebP both carry full alpha at 8, 10, or 12 bits. For any cutout, badge, or rounded icon that must sit cleanly on varied backgrounds, GIF produces visibly worse edges than PNG or AVIF.
Why animated GIFs are huge
Animated GIFs are large because LZW compresses each frame on its own, with no motion prediction between frames. Modern video and image codecs encode only what changes from frame to frame. GIF cannot. A 3-second loop repeats most of its pixels every frame, and LZW re-encodes them every time.
Two factors compound the bloat:
- No inter-frame coding — GIF stores frames independently, so a static background pays full cost on every frame.
- Weak intra-frame coding — LZW from 1985 is far behind AV1's transform-based compression.
A single animated GIF often weighs 5–10 MB, where the same clip as AVIF can land under 500 KB. The ezgif team documents this in alternatives to animated GIF.
How much smaller animated AVIF is
Animated AVIF typically cuts an animated GIF's size by 80–90% or more at matched visual quality. AVIF encodes each still as an AV1 keyframe and uses AV1's inter-frame tools across the loop, so unchanged regions cost almost nothing.
Concrete numbers from public tests:
- A 15-GIF benchmark from Wikipedia showed a median saving near 86% when re-encoded to AVIF.
- Google's web.dev team reports large reductions converting GIF animation to AV1-based formats, in Deploying AVIF for more responsive websites.
- A 5–10 MB reaction GIF commonly drops below 500 KB as AVIF.
For loops longer than a few seconds, a short MP4 or WebM video compresses even further than animated AVIF, often to a fraction of the AVIF size. Both AVIF and video share the AV1/HEVC lineage that GIF predates by decades.
Where GIF still appears
GIF survives because its decode support is universal and its "drop it in and it plays" workflow is frictionless. No newer format matches that reach across closed platforms. GIF still turns up in four places:
- Chat and messaging stickers — reaction libraries in Slack, Discord, and SMS deliver GIFs by default.
- Legacy email — many email clients animate GIF reliably but ignore animated AVIF and video.
- Cross-platform memes — content shared between heterogeneous apps relies on GIF's ubiquity.
- Ancient browser fallbacks — environments too old for
<picture>negotiation.
The persistence is about distribution beyond systems you control, not technical merit. The brief history of the GIF at Smithsonian Magazine traces this cultural endurance.
How to replace a GIF on your own site
Serve a modern source first and keep the GIF only as a fallback. On a site you control, animated AVIF or video wins decisively on bytes and quality.
For an animated image, use <picture>:
<picture>
<source type="image/avif" srcset="/anim/loop.avif" />
<img src="/anim/loop.gif" alt="…" width="480" height="270" loading="lazy" decoding="async" />
</picture>
For anything longer than a few seconds, a muted autoplay video is usually the right answer:
<video autoplay loop muted playsinline width="640" height="360" poster="/anim/poster.avif">
<source src="/anim/loop.webm" type="video/webm" />
<source src="/anim/loop.mp4" type="video/mp4" />
</video>
These swaps shrink the payload and improve Core Web Vitals. See AVIF Optimization for encoding the AVIF sources.
When to keep GIF and when to drop it
Keep GIF only when the file leaves your control and must play everywhere:
- Reaction images and stickers re-shared across chat apps.
- Email animation where AVIF and video support is unreliable.
- Backwards compatibility you cannot otherwise guarantee.
Drop GIF for everything else:
- Photographs — the 256-colour limit forces banding; Convert JPG to AVIF instead.
- Static graphics — PNG and WebP win on colour and size.
- On-site animation — animated AVIF or video cuts 80–90% of the bytes.
- Cutout edges — GIF's 1-bit alpha jags; AVIF and SVG carry clean edges.
FAQ
Can GIF show more than 256 colours? Not within one frame. Each frame is limited to a 256-entry palette. Animations can vary the palette per frame, but no single frame exceeds 256 colours.
Is animated AVIF really smaller than GIF? Yes. Public benchmarks show median savings near 86%, and 80–90%+ reductions are typical, because AVIF uses inter-frame compression that GIF lacks.
Why does my GIF logo have jagged edges? GIF supports only 1-bit transparency, so it cannot blend a soft edge into the background. Use PNG or AVIF for anti-aliased alpha.
Should I convert GIFs for email? Usually no. Many email clients animate GIF but ignore animated AVIF, so GIF stays the safer choice in newsletters.
What replaces GIF for a long animation? A short MP4 or WebM video. It compresses further than animated AVIF and suits clips longer than a few seconds.
Sources and further reading
- GIF — Wikipedia
- Deploying AVIF for more responsive websites — web.dev
- Alternatives to animated GIF — ezgif
- A Brief History of the GIF — Smithsonian Magazine
- AVIF format overview — the recommended replacement
- AVIF vs PNG — choosing for transparent graphics
- Lossy vs Lossless Compression — choosing a mode