ImagePDF.Tools
Performance & SEO

Why Do Animated GIFs Look Grainy? (And How to Convert to Smooth Animated WebP)

N
NikolaLast updated on November 12, 2026 · 4 min read

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.

A sky gradient rendered as a dithered GIF frame next to the same frame as a smooth animated WebP | ImagePDF.Tools | ImagePDF.Tools
Same frame, two formats. The dots on the left are the encoder hiding a 256-color limit.

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

GIFAnimated WebPMP4 or WebM video
Colors per frameUp to 25624-bit (millions)Millions
TransparencyOn or off per pixel8-bit alpha, smooth edgesGenerally no (WebM VP9 can carry alpha)
Typical sizeLargestGoogle reports 64% smaller than GIF as lossy, 19% as losslessUsually smallest for long or large clips
Works in an img tagEverywhereChrome 32+, Edge 18+, Firefox 65+, Safari 14+No, needs a video tag
Figures from the GIF89a specification and Google's WebP FAQ.

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:

bash
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=15 keeps 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:-1 sets 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 75 is the lossy quality on a 0 to 100 scale. Raise it if you see blocky smearing in fast motion.
  • ●-loop 0 loops forever, like a GIF. -an drops 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:

bash
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.webp

Without -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:

bash
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=diff weights 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?
Many sites re-encode uploads. Some shrink the GIF and rebuild its palette, which adds a second round of dithering, and others turn GIFs into video. Upload the cleanest version you can and keep its dimensions close to how the site shows it.
Can animated WebP have a transparent background?
Yes, with a full 8-bit alpha channel, so soft edges and shadows blend into any background. Make the transparent version from a source that has real transparency, such as a PNG sequence or a video with an alpha channel; a GIF's hard-edged mask will carry over as it is.
Will animated WebP play in email?
Do not rely on it. Support in email clients is patchy, and some desktop clients show only the first frame of any animation. GIF is still the safe choice in newsletters; keep it short and small.
Is there a size limit for animated WebP?
Each frame can be at most 16383 by 16383 pixels. In practice, file size and memory are the limits: a long, large animation decodes every frame in the browser, so a video is the better container for anything big.

Sources & references

This article was researched and written by Nikola, drawing on the following primary sources and documentation:

Ready to try it?

All tools run entirely in your browser, no uploads, no account required.

Convert to WebP