Where a GIF's bytes go
A GIF is a stack of frames, each squeezed by the same 1987 compression scheme, each limited to 256 colours. Two things decide its size: how much of each frame is stored, and how noisy the colours are. Storing only the changed part is free; reducing colours and frames is a trade, so it is yours to make.
- Lossless: changed rectangles only, transparency reuse, exact colour tables. Every displayed pixel kept.
- Fewer colours: one palette shared by every frame (median cut), optionally dithered, 2 to 256 colours.
- Identical consecutive frames merged into one, their delays added together.
- Every second or third frame kept, delays summed, so the clip runs as long as before.
- A smaller long edge for every frame.
- A byte cap: lossless first, then the palette searched, floor first, in at most eight encodes.
- Or save as an animated WebP: same frames, timing and loop, written by libwebp (lossy or lossless) in a background worker.
No lossy LZW, and WebP is not for everywhere.
Lossy LZW (the gifsicle trick) is not offered: no licence-clean implementation is part of this build. Animated WebP plays in every current browser but not in every chat app, email program or editor; the GIF option stays the default for that reason.
Questions people arrive with
Will my GIF still animate?
How can it get smaller without losing quality?
What do the other settings cost?
Should this GIF be a video instead?
Should I save it as an animated WebP instead?
Is there a size limit?
Elsewhere on this site
- Check image size in KBA GIF's frames, running time and loop, read without changing it.
- Compress PNGFor a still graphic, PNG with a small palette usually beats a one-frame GIF.
- Compress image to KBA still picture to a byte cap.

