Compress a GIF to an exact file size
Shrink a GIF to an exact KB or MB target. The tool re-encodes locally until it fits, so you get the best quality that still passes the limit.
- Runs in your browser
- Files are never uploaded
- Free, no account
First use downloads the 10 MB video engine from this site. After that it is cached and works offline. It is WebAssembly served by onthisdevice.com — never a third-party CDN — and your file is still processed entirely on your own device.
How the exact-size search works
Almost every GIF compressor gives you a "quality" slider and leaves you to guess. That is not a design choice — it is an economic one. Each attempt on an upload-based service costs them a round trip and a server encode, so they can only afford to run one. Here the encoding happens on your own processor, which makes the loop free, so the tool can search instead of guess.
- A ladder of thirteen settings is defined, from "full size, 256 colours" down to "18% size, 5 fps, 16 colours". Each rung moves resolution, frame rate and palette together, because changing only one of them wastes quality that could have been spent elsewhere.
- The tool encodes the middle rung and measures the result.
- Too big, and it discards the better half of the ladder; small enough, and it discards the worse half — then repeats.
- After about four encodes it has found the highest-quality rung that fits, and that is the file you download. The full list of attempts and their byte counts is shown so you can see the working.
The three levers, and what each one costs
| Lever | Typical change | Size effect | What you lose |
|---|---|---|---|
| Resolution | 480 → 340 px wide | About −50% | Fine detail and small text become unreadable |
| Frame rate | 24 → 12 fps | About −50% | Fast motion judders; most screen captures look unchanged |
| Palette | 256 → 64 colours | −25% to −40% | Gradients band; flat graphics often look identical |
| Dithering | Sierra2 → Bayer | −15% to −25% | A visible cross-hatch pattern instead of fine grain |
| Length | 10 s → 5 s | −50%, exactly | Half the clip — trim it before you compress |
Length is the one lever this tool cannot pull for you, and it is the most effective of the five. If a GIF is fighting a hard limit, cutting three seconds off the front usually beats any amount of quality reduction.
The limits people are actually fighting
| Destination | Limit | Notes |
|---|---|---|
| Discord (free) | 10 MB per attachment | Use the 8 MB preset for headroom; Nitro raises it substantially |
| Discord / Slack custom emoji | 256 KB and 128 KB, at 128 px | Resize first, then compress — see Resize GIF |
| Email attachment | Commonly 10 MB, often 2 MB in practice | Corporate gateways strip or reject far below the advertised limit |
| Forum avatar or signature | Frequently 256 KB or 512 KB | Often with a pixel cap as well |
| WordPress and most CMSs | 2 MB default upload cap | Set by PHP, not by the CMS itself |
Why dithering choice matters when chasing a byte target
Dithering hides colour banding by scattering error across neighbouring pixels. Error-diffusion methods like Sierra 2-4A and Floyd–Steinberg look the most natural, but the noise they add is essentially random, and random data is exactly what LZW compression cannot compress. Bayer dithering uses a fixed repeating matrix instead: it looks slightly more artificial, and it compresses much better because the pattern repeats. When you are 15% over a hard limit, switching to Bayer often closes the gap without touching resolution at all.
What "optimising" actually removes
Even with no size target, re-encoding usually shrinks a GIF noticeably. Most GIFs in
circulation were exported by tools that reused a generic palette and stored every frame in
full. This tool builds a palette from your specific clip using stats_mode=diff,
which weights the colours that change between frames so that a moving subject is not sacrificed
to a static background, and lets FFmpeg store inter-frame differences where it can.
Nothing is uploaded — and you can check
Every encode in the search runs in this tab, in FFmpeg compiled to WebAssembly and served from this site rather than a third-party CDN. Open your browser’s developer tools, switch to the Network tab, and compress a GIF: after the one-time engine download there are no requests at all. Turning off Wi-Fi and doing it anyway works just as well as a demonstration.
When to give up on GIF
If the smallest rung on the ladder still misses your target, the animation is too long or too detailed for the format. GIF has no motion prediction: a ten-second clip is genuinely ten seconds of full images. Converting with GIF to MP4 typically produces a file five to twenty times smaller at better quality, and every modern platform plays a short muted video inline exactly as it would a GIF.
Questions
How does it hit an exact size?
It binary-searches a quality ladder that moves resolution, frame rate and palette size together, encoding your GIF locally at each step until it finds the best-looking version that fits. That is usually four encodes. An upload-based compressor would have to charge for four round trips, which is why they give you a single fixed slider instead.
What target should I pick for Discord?
Discord accepts 10 MB on a free account and rejects anything over it with a generic error, so the 8 MB preset leaves headroom. For a Discord or Slack custom emoji you need 128 px and under 256 KB — the Resize GIF tool has that preset.
Why did the tool cut the frame rate as well as the size?
Frame count is the biggest single contributor to GIF size, because every frame is stored in full. Dropping 24 fps to 12 fps roughly halves the file and is almost invisible on screen recordings and reaction clips. The ladder only reduces frame rate once resolution and palette cuts are no longer enough.
It still could not reach my target. What now?
Long or highly detailed GIFs have a floor. Trim the clip shorter first, or convert it to MP4 — H.264 uses motion prediction and typically lands five to twenty times smaller than the same animation as a GIF. Every chat app and social network plays short muted MP4s inline now.