GIF compression, measured: dimensions vs. presets
GIFs keep showing up where they shouldn't: README demos, changelogs, chat attachments, landing page hero images. They're usually the heaviest single asset on the page, and they're the one format where "just export it aga
GIFs keep showing up where they shouldn't: README demos, changelogs, chat attachments, landing page hero images. They're usually the heaviest single asset on the page, and they're the one format where "just export it again at 80% quality" doesn't apply β GIF has no quality slider, only a 256-colour palette and whatever lossy tricks you're willing to run.
So I measured the two levers you actually have: dimensions and compression preset. Same source image, one variable at a time.
The setup
- Source: one 1200Γ676 screenshot-style image, exported as a GIF (135.0 KB)
- Two downscaled copies: 600Γ338 (47.5 KB) and 300Γ169 (18.1 KB)
- Compressor: Gifsicle compiled to WebAssembly, running client-side (no upload)
- Every file compressed three times, once per preset: Best Quality / Balanced / Smallest File
- Sizes as reported after compression, in KB
A caveat up front: these test files are single-frame GIFs, so this post measures palette/quantisation and scaling behaviour, not frame-count reduction. If your GIF is an animation, frame stride is a fourth lever β but that's a different test.
Lever 1: dimensions win, and it isn't close
Balanced preset, same image at three widths:
| Width | File size | Change vs. previous |
|---|---|---|
| 1200Γ676 | 135.0 KB | β |
| 600Γ338 | 47.5 KB | β65% |
| 300Γ169 | 18.1 KB | β62% |
Halving the width cut the file by roughly two-thirds, twice in a row. That's the whole argument for checking whether the GIF really needs to be 1200px wide before you touch any compression setting: at 600px it's already a third of the weight, and at thumbnail size it's 13% of the original.
Lever 2: the preset is a second lever, not the first
Same three files, three presets, totals across all of them (200.6 KB original):
| Preset | Total output | Saved |
|---|---|---|
| Best Quality | 122.5 KB | 39% |
| Balanced | 94.1 KB | 53% |
| Smallest File | 55.7 KB | 72% |
Per file, on the 1200-wide original:
| Preset | 1200Γ676 | 600Γ338 | 300Γ169 |
|---|---|---|---|
| Original | 135.0 KB | 47.5 KB | 18.1 KB |
| Best Quality | 81.2 KB (β40%) | 29.6 KB (β38%) | 11.7 KB (β35%) |
| Balanced | 61.1 KB (β55%) | 23.4 KB (β51%) | 9.6 KB (β47%) |
| Smallest File | 35.6 KB (β74%) | 14.4 KB (β70%) | 5.6 KB (β69%) |
Two things worth noticing:
- The savings are remarkably stable across sizes. A preset that saves 40% on the big file saves 35% on the small one. The preset isn't fighting the dimensions; the effects stack.
- The gap between presets is bigger than the gap between "compressed" and "uncompressed." Balanced to Smallest File is another β41% on top of what Balanced already removed. If your budget is tight and the GIF is decorative, that's the cheapest win left.
What the presets actually cost you visually
Nothing here is free:
- Best Quality β dithering and palette are kept close to the original. Use it for screenshots with text, UI captures, anything where a gradient banding artefact would be obvious.
- Balanced β the sane default for social and chat GIFs. On photographic content I could not pick it out of a side-by-side at 100%.
- Smallest File β aggressive palette reduction. Fine for thumbnails and previews; on flat UI colours it starts to look grainy.
Rule of thumb from the numbers: resize first, then choose the weakest preset that still looks right. Resizing is where the orders of magnitude are; the preset is the trim.
When you should not use a GIF at all
Honest version: if the asset is a looping animation with photographic colour, an MP4 or WebM will beat any GIF optimiser β usually by a factor, not a percentage. GIF's 256-colour limit is not a compression setting you can tune your way out of. Reach for GIF when you need inline playback everywhere, transparency tricks, or a file that renders identically in an <img> tag with no JS.
Why this runs in the browser
Gifsicle has been the reference tool for years. What changed is that it can now run as WebAssembly, which means the compression happens in the tab: no upload, no server-side size limit, no queue, and no third party holding a copy of a GIF that might contain something private (a support screenshot, an unreleased UI, a customer's data).
That's the setup I run tests on: GifCompressor β 20 files per batch, 100 MB per file, free, no account. Disclosure: I maintain it. The measurements above come from it, but the levers apply to any Gifsicle-based tool.
Checklist
- Does the GIF need to be that wide? Halve it and look again β that's β60% before you've done anything clever.
- Then pick the weakest preset that survives a 100% zoom check.
- If it still isn't small enough, ask whether it needs to be a GIF.
- Keep it local if the content is private.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.