GIF Compressor

Cut the weight of an animated GIF, and keep the animation running for the same length of time.

Runs on your deviceMoreWorkingNo account needed

What this tool does

GIF Compressor takes the file apart and builds a new one. The GIF is parsed in JavaScript — the LZW streams are decoded, each frame's own palette is read, and the disposal method is honoured so partial frames composite the way a viewer would draw them. Every kept frame is then redrawn on a canvas at the size you asked for and handed to gif.js, which picks a fresh 256-colour palette per frame and encodes the result in Web Workers. Your GIF is never sent anywhere and no copy of it is kept. What does cross the network is the tool's own code — the processor module, gif.js and its worker script, all served from this site and all fetched on first use, then reused from memory.

There is no quality slider in GIF the way there is in JPEG, because the format has no such dial: size comes from pixel area, multiplied by frame count, plus the cost of the palettes. So the controls are those three levers directly. Frames keeps every frame, or every 2nd, 3rd or 4th. Scale runs from 25% to 100% in 5% steps, and matters most, since bytes fall roughly with the square of it. Colours sets how densely the encoder samples pixels when it builds each palette — sampling every pixel gives the truest colour and the largest file, sparse sampling gives a rougher one and a smaller file. Dropped frames hand their delay to the frame kept before them, so a clip that ran for four seconds still runs for four seconds; it simply steps more coarsely. The original's loop setting survives too: a GIF with no loop block still plays once, and one set to loop forever still does.

The second mode aims at a number instead. Give it a maximum in KB or MB and it re-encodes repeatedly, changing one lever at a time in order of least visible damage: the palette sampling first, then the scale, then — only if you leave the frame-dropping box ticked — the frame rate. Each candidate is really encoded and its bytes counted, so the size reported is the size of the file you get. Two behaviours protect you from a pointless result. A GIF already under the budget is handed straight back untouched, because re-encoding it would probably make it bigger. And if the search stops with every attempt larger than the source, the original is returned unchanged with a note saying so, rather than a quarter-size animation that somehow weighs more.

It is worth knowing in advance where this stops. Re-encoding a GIF that was already well optimised often gains nothing, and when that happens the result says plainly that it is not smaller than the original. Dithering is switched off, which keeps the file down but leaves visible banding in gradients and soft shading. Every pass composites, scales and quantises every frame, which is slow — a 36-frame 480×360 animation takes tens of seconds for a single pass — so the size search is rationed: five further attempts after the first on a small GIF, only two on a large one, and a large one opens at 60% scale with the coarsest palette instead of working down from full size. That ration is also why the search can give up while settings it never tried remain. Decoding refuses a file outright past 2,000 frames or 300 million total frame pixels. The output is always a GIF: nothing here trims the clip, reorders it, or writes a modern format, and any comment block in the source is dropped.

How to use it

  1. Add the GIF. Animated or still GIF files only. Several can be queued and each is compressed on its own, one after another. Anything that is not a GIF is refused with the header bytes it actually found, so a renamed PNG or MP4 fails immediately rather than halfway through.
  2. Choose between settings and a size budget. Aim for is the choice: leave it on These settings and the three levers stay in your hands. A maximum file size hides them and searches instead, which is what you want when a form or a chat room has named a figure.
  3. Set frames, scale and colours. Keep every frame, or every 2nd, 3rd or 4th; scale between 25% and 100%; and pick best, balanced or fewest colours. Balanced at 100% scale is the starting point if you are unsure.
  4. Or type the budget. A figure from 1 KB upwards, in KB or MB — anything under 1 KB is refused as unreachable for an animation. Leave Drop frames ticked unless the smoothness matters more than the number.
  5. Pick how transparency is handled. Flatten paints transparent pixels onto a background colour, white by default. Keep transparency reserves an unused colour as the transparent key and is approximate — expect a thin fringe at the edges.
  6. Check the figures in the summary. Working the levers yourself gives you the original and final sizes, the percentage saved, the frame count before and after, the new dimensions and what became of transparency. A size budget reports the target you named and whether it was met, in place of that percentage.

Processing & privacy

Runs on your device. Your file is processed directly in this browser.

Common use cases

Getting under an upload cap

Issue trackers, forums and chat rooms cap attachments at a few megabytes, and a screen recording turned into a GIF sails past that easily. Naming the figure is quicker than guessing at a scale percentage twice.

Lightening a README or documentation loop

A demo GIF sitting in a repository is downloaded by everyone who opens the page. Halving the width takes roughly three quarters of the bytes off it and still reads fine at the size it is displayed.

Thinning a high frame rate screen capture

Recorders often write 25 or 30 frames a second for a cursor moving slowly. Keeping every 3rd frame removes two thirds of the frames and the motion still reads, because the timing is redistributed rather than sped up.

Preparing a smaller GIF for an email or a newsletter

Mail clients and campaign tools weigh every embedded image. Scaling to the width it will actually be displayed at, with the coarsest palette, usually brings the file into a sensible range.

Questions

Is my GIF uploaded?
No. Parsing, compositing and encoding all happen in this browser tab, with gif.js running the encoder in Web Workers. The requests the page makes are for its own scripts — the processor module, the encoder and the encoder's worker — and never for your file. Open the network panel of your browser while a GIF compresses and you can watch that for yourself.
Why is the result the same size, or bigger?
Because the file was already close to what GIF can do. The tool re-encodes from scratch with its own palette, so a well-optimised source can come back level or heavier — and when it does, the summary says so and reports both figures instead of pretending otherwise.
Why does it take so long?
Every frame is composited, redrawn at the new size and quantised into a fresh palette, and the size-budget mode repeats that whole job for each attempt. Tens of seconds for a few hundred frames is normal, and the run can be cancelled while it works.
It could not reach the size I asked for. What now?
The bottom of the ladder is 25% scale, the coarsest palette and every 4th frame — but the attempt ration can end the search above that, so it may stop with settings it never reached. Either way the realistic moves are a shorter animation, or GIF to MP4, which typically lands an order of magnitude below anything a GIF can reach.
Does dropping frames make the animation run faster?
No. Each dropped frame's delay is added to the frame kept before it, so total runtime is unchanged and only the smoothness drops. The self-test for this tool checks that the durations before and after match exactly.
Is transparency preserved?
Only approximately. Re-encoding cannot reproduce the original transparent index, so Keep transparency picks a colour no palette in your file uses and marks that as transparent. If all six candidate colours are already in use it falls back to flattening onto the background colour instead.
Why do gradients look banded afterwards?
Each frame is limited to 256 colours and dithering is deliberately off, because the noise dithering adds is expensive to compress. Flat graphics, text and screen recordings survive this well; photographic gradients and skin tones band.
Can it compress an animated WebP or APNG?
No — only GIF goes in and only GIF comes out. Use the APNG Converter for APNG files, GIF Resizer when you want to change the dimensions and nothing else, and GIF Splitter when you want the individual frames.

Related tools

  • Video to GIF — Turn a short clip into an animated GIF.
  • QR Code Generator — Create a QR code for a link, text, Wi-Fi or vCard.
  • GIF Maker — Build an animated GIF from images or a clip.
  • GIF to MP4 — Convert a GIF to a much smaller MP4 video.
  • GIF Splitter — Split an animated GIF into individual frames.
  • GIF Resizer — Resize an animated GIF without losing the animation.