Convert GIF to WebP: 4 Methods Compared (2026)
GIF files are everywhere — reaction memes, product demos, UI walkthroughs — but they are also painfully large. A 10-second GIF can easily weigh 5 MB or more, dragging down page load times and burning through mobile data.
WebP fixes this. Google's format supports animation just like GIF, but with dramatically better compression. When you convert GIF to WebP, expect file size reductions between 25% and 80% with no visible quality loss. That is not a typo — a 4 MB animated GIF routinely shrinks to under 1 MB as WebP.
This guide covers four methods to make the conversion, from a zero-install browser tool to CLI commands and code libraries. Pick the one that fits your workflow.
Why Convert GIF to WebP?
GIF was designed in 1987. It uses lossless compression with a hard limit of 256 colors per frame, which means large palettes get dithered and file sizes balloon for anything beyond simple graphics.
WebP, introduced by Google in 2010 and now supported by every major browser, uses both lossy and lossless compression with no color limit. For animated content, WebP uses modern inter-frame compression — it only stores the pixels that change between frames instead of re-encoding the entire image.
The practical benefits:
- Smaller files. 25-80% reduction depending on content complexity. Photographic GIFs see the biggest gains.
- Better quality. 24-bit color (16.7 million colors) vs. GIF's 8-bit (256 colors). No more dithering artifacts.
- Same animation support. Frame-by-frame animation with configurable delays, loop counts, and alpha transparency.
- Faster pages. Smaller images mean faster load times, better Core Web Vitals, and improved SEO signals.
Try it yourself
Convert between any image format instantly — free, instant, no signup. Your images never leave your browser.
GIF vs WebP: Side-by-Side Comparison
| Feature | GIF | WebP |
|---|---|---|
| Max colors | 256 (8-bit) | 16.7 million (24-bit) |
| Compression | Lossless (LZW) | Lossy + lossless |
| Animation | Yes | Yes |
| Transparency | Binary (on/off) | Full alpha channel (8-bit) |
| Typical file size | Large | 25-80% smaller |
| Browser support | Universal | 97%+ (all modern browsers) |
| Lossy option | No | Yes |
| Metadata | Limited | EXIF, XMP, ICC profiles |
The only scenario where GIF still wins is universal compatibility with legacy software. Email clients, some older chat apps, and certain CMS platforms still handle GIF better than WebP. For web publishing, WebP is the clear choice.
Method 1: Pixotter Online Tool (No Install)
The fastest path from GIF to WebP — no software to install, no files uploaded to a server.
- Open Pixotter Convert.
- Drop your GIF file onto the page.
- Select WebP as the output format.
- Adjust quality if needed (80 is a good default for animated content).
- Click convert and download your WebP file.
Everything runs client-side in your browser via WebAssembly. Your images never leave your machine, which matters if you are working with proprietary assets or client files.
This method handles both static and animated GIFs. For batch conversions, drop multiple files at once.
Convert GIF to WebP instantly
Drop your GIF, select WebP output, and download — free, no upload, runs in your browser.
Method 2: CLI with cwebp and ffmpeg
For automated pipelines and batch processing, command-line tools give you full control.
Static GIF to WebP with cwebp
Google's cwebp (version 1.4.0) converts static GIFs directly:
# Install libwebp 1.4.0 (includes cwebp)
# macOS
brew install webp
# Ubuntu/Debian
sudo apt install webp=1.4.0-*
# Convert a static GIF to WebP at quality 80
cwebp -q 80 input.gif -o output.webp
Animated GIF to WebP with ffmpeg
For animated GIFs, ffmpeg (version 7.0) handles the conversion with fine-grained control:
# Convert animated GIF to WebP with ffmpeg 7.0
ffmpeg -i animated.gif -vcodec libwebp -lossless 0 -q:v 75 -loop 0 -an -vsync 0 output.webp
# With custom frame rate (useful for smoothing choppy GIFs)
ffmpeg -i animated.gif -vcodec libwebp -lossless 0 -q:v 75 -loop 0 -r 15 -an output.webp
Key flags:
-lossless 0enables lossy compression (set to1for lossless)-q:v 75sets quality from 0 (worst) to 100 (best)-loop 0means infinite loop (match most GIF behavior)-anstrips audio (GIFs have no audio, but ffmpeg checks anyway)
Batch conversion (shell one-liner)
# Convert all GIFs in a directory
for f in *.gif; do ffmpeg -i "$f" -vcodec libwebp -lossless 0 -q:v 75 -loop 0 -an "${f%.gif}.webp"; done
Method 3: Node.js with sharp
The sharp library (version 0.33.x, MIT license) is the go-to for server-side image processing in Node.js. It wraps libvips and handles animated images natively.
// package.json: "sharp": "^0.33.5"
import sharp from 'sharp';
// Convert animated GIF to WebP
await sharp('input.gif', { animated: true })
.webp({ quality: 80 })
.toFile('output.webp');
// Batch convert all GIFs in a directory
import { readdir } from 'fs/promises';
import { join, basename } from 'path';
const dir = './images';
const files = (await readdir(dir)).filter(f => f.endsWith('.gif'));
for (const file of files) {
await sharp(join(dir, file), { animated: true })
.webp({ quality: 80 })
.toFile(join(dir, `${basename(file, '.gif')}.webp`));
console.log(`Converted: ${file}`);
}
The { animated: true } option is critical — without it, sharp only processes the first frame and you get a static image. This is the most common mistake when converting animated GIFs with sharp.
Method 4: Python with Pillow
Pillow (version 11.x, HPND license) handles GIF-to-WebP conversion including animation:
# pip install Pillow==11.1.0
from PIL import Image
# Convert animated GIF to WebP
with Image.open("input.gif") as img:
img.save(
"output.webp",
format="webp",
save_all=True, # Preserve all frames
quality=80,
method=6, # Slowest but best compression
loop=0 # Infinite loop
)
save_all=True is the key parameter. Without it, Pillow saves only the first frame — same trap as sharp's animated flag. The method parameter ranges from 0 (fast, larger files) to 6 (slow, smallest files). For a build pipeline where conversion time does not matter, use method=6.
For batch processing:
from pathlib import Path
from PIL import Image
for gif_path in Path("./images").glob("*.gif"):
with Image.open(gif_path) as img:
webp_path = gif_path.with_suffix(".webp")
img.save(webp_path, format="webp", save_all=True, quality=80, method=6, loop=0)
print(f"Converted: {gif_path.name} -> {webp_path.name}")
Which Method Should You Pick?
| Method | Best for | Animated support | Batch support |
|---|---|---|---|
| Pixotter | Quick one-off conversions, no install needed | Yes | Yes (multi-drop) |
| ffmpeg CLI | Build pipelines, CI/CD, maximum control | Yes | Yes (shell loop) |
| sharp (Node.js) | Server-side processing, JS/TS projects | Yes | Yes |
| Pillow (Python) | Python projects, data pipelines | Yes | Yes |
If you just need to convert a handful of GIFs right now, Pixotter's converter gets it done in seconds. For automated workflows, pick the library that matches your stack.
Frequently Asked Questions
Does converting GIF to WebP preserve animation?
Yes. WebP fully supports frame-by-frame animation with configurable delays and loop counts, just like GIF. All four methods in this guide preserve animation when configured correctly — use animated: true in sharp, save_all=True in Pillow, or the -vcodec libwebp flag in ffmpeg.
How much smaller is WebP compared to GIF?
Typical reductions range from 25% to 80%. Simple animations with flat colors see 25-40% savings. Complex, photographic animations often shrink by 60-80%. The gains come from WebP's modern inter-frame compression and support for lossy encoding.
Do all browsers support animated WebP?
As of 2026, animated WebP works in Chrome, Firefox, Safari, Edge, and Opera — covering over 97% of global browser usage. The only holdout is Internet Explorer, which Microsoft discontinued in 2022. For the rare legacy browser visitor, serve a GIF fallback using the <picture> element:
<picture>
<source srcset="animation.webp" type="image/webp">
<img src="animation.gif" alt="Descriptive alt text">
</picture>
Can I convert WebP back to GIF?
Yes. The conversion is reversible, though you may lose quality if the WebP used lossy compression. See our guide on converting WebP to GIF for step-by-step instructions.
What quality setting should I use for animated WebP?
Start at 75-80 for most animated content. This gives a good balance between file size and visual quality. For UI recordings and screen captures with text, bump it to 85-90 to keep text sharp. For memes and reaction GIFs where perfection does not matter, 60-70 works fine. You can always experiment — what is GIF explains the format's limitations that make nearly any WebP quality setting look better.
Should I use WebP or AVIF for animations?
WebP is the safer choice today. While AVIF offers even better compression for still images, animated AVIF support is inconsistent across browsers and encoding is significantly slower. WebP animation works everywhere and encodes fast. If you are already using WebP, consider also compressing your GIF source files before conversion to maximize savings.
Is there a file size limit for GIF-to-WebP conversion?
WebP supports images up to 16,383 × 16,383 pixels. For animated WebP, there is no hard frame count limit, but extremely long animations (thousands of frames) can hit memory constraints during encoding. If your GIF exceeds 50 MB, consider splitting it into shorter clips or reducing the frame rate before conversion.
Try it yourself
Ready to convert formats? Drop your image and get results in seconds — free, instant, no signup. Your images never leave your browser.