Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 3 min read

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:

  1. 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.
  2. 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

  1. Does the GIF need to be that wide? Halve it and look again β€” that's βˆ’60% before you've done anything clever.
  2. Then pick the weakest preset that survives a 100% zoom check.
  3. If it still isn't small enough, ask whether it needs to be a GIF.
  4. Keep it local if the content is private.
πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.