Compress GIF files
GIF compression has hard limits. The best “compression” is usually converting GIF to MP4/WebM for much smaller files.
Last updated: 2026-03-18
To compress GIF files, run npx optimo animation.gif. Optimo applies ImageMagick-powered compression by default. For stronger reduction, use --lossy or --resize to shrink dimensions — often the single biggest lever for file size.
Start with optimo
First, run optimo on your image file:
npx optimo animation.gif
This is safe: optimo keeps the original if the output isn't smaller.
Two big levers
1) Lossy mode
npx optimo animation.gif --lossy
2) Resize (dimensions)
npx optimo animation.gif --resize w1280
Practical tips
- If it’s animated, convert to MP4/WebM for huge size savings.
- If you must keep GIF (e.g. legacy constraints), keep it short and small.
- Mute is typically fine for GIF-like content; optimo defaults to muted video.
Related pages
Consider converting
Sometimes the best compression is picking a better delivery format.
Popular conversions
Frequently asked questions
- How do I compress GIF files?
- Run "npx optimo animation.gif" to compress GIF with lossless optimization. For stronger compression, add --lossy. For size reduction through resizing, add --resize followed by a percentage, dimensions, or target file size.
- What is the best way to reduce GIF file size?
- The two biggest levers are resizing (reducing dimensions to match display size) and lossy compression. Resizing usually has a larger impact than codec-level compression. Sometimes converting to a more efficient format is the best approach.