Why Do Animated GIFs Look Grainy? (And How to Convert to Smooth Animated WebP)
Summary
GIF frames can hold only 256 colors, so gradients turn into speckled dither or hard bands. Why that happens, and how to make a smooth animated WebP from the original video.
Animated GIFs look grainy because each frame can use at most 256 colors. A video frame has thousands. To fake the missing shades, the encoder scatters dots of nearby colors across the image, which is called dithering, and that speckle is the grain you see. Without dithering you get flat bands instead of smooth gradients.
Animated WebP stores full 24-bit color with an 8-bit alpha channel, so it can show the same clip without either problem, and it is usually smaller. The catch: converting an already grainy GIF keeps the grain. For a smooth result, convert from the source video.

Where the grain comes from
The GIF format dates from 1989 and stores pixels as indexes into a color table of up to 256 entries. Every frame has to be mapped onto that palette. Skin tones, skies, shadows and soft focus backgrounds contain far more shades than that, so the encoder has two choices:
- ●Dither: mix pixels of the available colors so that, from a distance, they average out to the missing shade. Up close it looks like film grain or sand.
- ●Do not dither: snap every pixel to the nearest palette color. Gradients become visible steps, an effect called banding or posterization.
Animation makes dithering worse. The dot pattern is recalculated for every frame, so in a still area of the picture the dots jump around and the image seems to fizz. That shimmering is often more noticeable than the grain itself, and it also inflates the file, because GIF compression works best when pixels repeat.
GIF transparency adds a second problem. A pixel is either fully transparent or fully opaque, with nothing in between, so curved edges look jagged and a GIF made for a white page shows a pale fringe on a dark one.
GIF, animated WebP and video compared
| GIF | Animated WebP | MP4 or WebM video | |
|---|---|---|---|
| Colors per frame | Up to 256 | 24-bit (millions) | Millions |
| Transparency | On or off per pixel | 8-bit alpha, smooth edges | Generally no (WebM VP9 can carry alpha) |
| Typical size | Largest | Google reports 64% smaller than GIF as lossy, 19% as lossless | Usually smallest for long or large clips |
| Works in an img tag | Everywhere | Chrome 32+, Edge 18+, Firefox 65+, Safari 14+ | No, needs a video tag |
Convert from the source video for a smooth result
If you made the GIF from a screen recording or a video clip, go back to that file. Its frames still have full color, so the WebP never passes through a 256-color stage. The free command-line tool ffmpeg does it in one line:
ffmpeg -i clip.mp4 -vf "fps=15,scale=640:-1:flags=lanczos" \
-c:v libwebp -lossless 0 -quality 75 -compression_level 6 \
-loop 0 -an clip.webp- ●
fps=15keeps 15 frames per second. Most UI demos and reaction clips look fine at 12 to 15; fewer frames is the biggest single saving. - ●
scale=640:-1sets the width and keeps the aspect ratio. Use the width the clip is actually shown at, doubled if it should be sharp on high-density screens. - ●
-quality 75is the lossy quality on a 0 to 100 scale. Raise it if you see blocky smearing in fast motion. - ●
-loop 0loops forever, like a GIF.-androps the audio track, which WebP cannot hold anyway.
Screen recordings with flat colors and text often compress better losslessly. Swap in -lossless 1 and compare the two file sizes.
Converting a GIF you only have as a GIF
Google's gif2webp, part of the libwebp tools, converts an existing GIF directly:
gif2webp -lossy -q 80 -m 6 animation.gif -o animation.webp
# or let it choose lossy or lossless per frame
gif2webp -mixed -m 6 animation.gif -o animation.webpWithout -lossy or -mixed, gif2webp is lossless, which reproduces every dithered dot exactly. Lossy mode at a moderate quality smooths the finest dither slightly and usually gives the smaller file, but it cannot bring back colors that were thrown away when the GIF was made. Expect a lighter file that looks about the same, not a cleaner picture.
Our image converters work on still images only. An animated GIF dropped into them comes out as a single frame, which is handy for a poster image but not for the animation itself. Use ffmpeg or gif2webp for that.
If you have to deliver a GIF
Some places only accept GIF: certain chat apps, forums, issue trackers and email. You can still make it far less grainy by building a palette from the clip itself and using a steadier dither:
ffmpeg -i clip.mp4 -vf "fps=12,scale=480:-1:flags=lanczos,split[a][b];\
[a]palettegen=stats_mode=diff[p];\
[b][p]paletteuse=dither=bayer:bayer_scale=4:diff_mode=rectangle" clip.gif- ●palettegen picks the 256 colors that best fit this clip, instead of a generic web palette.
stats_mode=diffweights the colors of moving areas, where the eye looks. - ●dither=bayer uses an ordered pattern that stays in the same place from frame to frame, so still areas stop fizzing. A higher
bayer_scale(up to 5) shows less pattern but more banding. - ●diff_mode=rectangle only re-dithers the part of the frame that changed, which cuts shimmer and file size.
- ●The free app gifski is another good option. It builds a separate palette for each frame and handles gradients well, at the cost of larger files.
Putting animated WebP on a web page
An animated WebP goes in an ordinary <img> tag, just like a GIF. To keep a fallback for very old browsers, wrap it in a <picture> element with a type="image/webp" source and the GIF as the img. For clips longer than a few seconds, a muted, looping video element with autoplay muted loop playsinline is usually smaller still.
Frequently asked questions
Why does my GIF look fine on my computer but grainy after I post it?
Can animated WebP have a transparent background?
Will animated WebP play in email?
Is there a size limit for animated WebP?
Sources & references
This article was researched and written by Nikola, drawing on the following primary sources and documentation:
- ●W3C, Graphics Interchange Format GIF89a specification
- ●Google for Developers, WebP FAQ (animated WebP size, limits and browser support)
- ●Google for Developers, gif2webp command-line options
- ●FFmpeg, filter documentation including palettegen and paletteuse
- ●web.dev, replace animated GIFs with video for faster page loads
Ready to try it?
All tools run entirely in your browser, no uploads, no account required.
Convert to WebPMore in Performance & SEO
How to Fix "PDF Exceeds Maximum File Size Limit" on arXiv and Academic Portals
How to Optimize Images for Apple Retina and High-DPI Screens Without Bloating Page Weight
Best Image Format and Dimensions for Website Favicons and App Touch Icons (2026 Guide)

