GIF Compressor

Compress an animated GIF in your browser, no upload: lossy LZW, lossy frame diffing, fewer colors, smaller width, frame skipping. Compare, then download.

  • Runs in your browser
  • Tool input is not uploaded to ZeroTool servers
  • Free · No Sign-Up

GIF comparison

Compare both animations and the size summary. A larger result can still be downloaded.

Select a GIF to compare the original and compressed animation.

Read the full guide GIF Compressor: Shrink Animated GIFs with Lossy LZW and Fewer Colors
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

Two Real GIFs, Before and After

Both files are public on Wikimedia Commons, so you can download them and repeat the test. Sizes are in bytes, at the default settings (Lossy 40, 256 colors, all frames, no dithering).

A rendered animation. Rotating earth (large).gif is 400 × 400 px with 44 frames and 1,001,718 bytes. The globe turns, so most pixels change in every frame. The result is 541,524 bytes (54%) with 255 colors. Half the width (200 px) brings it to 180,441 bytes (18%).

A screen recording. Auto-citing a source using VisualEditor, small.gif records a Wikipedia editing session at 500 × 245 px with 114 frames and 698,529 bytes. Text and a cursor move; the page around them stands still. The result is 245,538 bytes (35%). At Lossy 100 it is 75,168 bytes (11%), but the SSIM against the original falls from 0.991 to 0.932: light-gray details such as the Edit button's border disappear, and faint traces of earlier frames stay on screen, because changes that small are not redrawn.

In Chrome on an M1 Max laptop, the result appeared 0.8–2.8 s (globe) and 3.5–4.8 s (recording) after the file was picked, over several runs. The same encoder code takes 0.37 s and 0.74 s in Node.js 24 on that machine.

What Each Setting Does to the File Size

SettingWhat it changesEffect on the screen recording above
Lossy (0–100, default 40)Lets LZW reuse sequences with colors up to Lossy × 0.6 away100% at 0, 35% at 40, 11% at 100
Colors (256 to 4)Size of the color table; one slot is kept for transparency33% at 64 colors with Lossy 40
WidthScales the GIF down; height follows the aspect ratio5.7% at half width with Lossy 40
FramesKeeps every 2nd, 3rd or 4th frame22% with every 2nd frame and Lossy 40
DitheringFloyd–Steinberg error diffusion41% instead of 33% at 64 colors

Width only shrinks, and each output pixel is the area average of the source pixels it covers. Dropped frames add their display time to the kept frame before them, so the animation keeps its total length.

How It Compares with gifsicle and ezgif

ezgif uploads your file and runs it through gifsicle with its lossy LZW encoder. gifsicle runs on your own machine. This page runs in the tab and applies its lossy threshold in two places: inside LZW, like gifsicle's --lossy, and between frames, where a pixel whose new color is within the lossy distance of what is already on screen is left undrawn. On footage where the picture barely moves, the second step removes most of each frame. ezgif offers a similar frame step as a separate method, "Optimize Transparency" with a fuzz factor.

The two lossy scales are different: gifsicle measures the error in a gamma-corrected color space, so equal numbers are not equal settings. The table therefore compares file size at a similar SSIM, measured against the original with ffmpeg 9.0 (1.0 means identical). gifsicle is version 1.93.

FileThis tool, defaultgifsicle -O3 --lossy=80
Rotating earth541,524 B, SSIM 0.956575,411 B, SSIM 0.965
Newton's cradle, 480 × 360, 36 frames, 308,156 B109,817 B, SSIM 0.971182,247 B, SSIM 0.967
VisualEditor recording245,538 B, SSIM 0.991549,574 B, SSIM 0.991

On the globe, where every pixel changes, the two are close. On the other two files this page's output was 40% and 55% smaller at the same or better SSIM. Repeat the test with these commands, where out.gif is the file you downloaded:

gifsicle -O3 --lossy=80 in.gif -o gifsicle.gif
ffmpeg -i in.gif -i out.gif -lavfi "[0:v]format=yuv444p[a];[1:v]format=yuv444p[b];[a][b]ssim" -f null -

gifsicle and ezgif do more: batch jobs, cropping, several palette and dithering methods, and files far above this page's size limit. Use them for those jobs.

How Frame Optimization Works

The first frame covers the whole canvas. For every later frame, the tool writes only the rectangle that holds changed pixels. Unchanged pixels inside it use the transparent index, which compresses into long runs. A frame with no change becomes a single transparent pixel that keeps its delay. When a visible pixel must turn transparent, the frame before it gets disposal method 2 (restore to background), as defined in the GIF89a specification.

The palette is built once for the whole animation: exact if the frames use few enough colors, median cut otherwise.

Limits

  • Size. 50 million decoded pixels, 1,000 frames and 16,777,216 pixels per frame. Terminal and app recordings often go over: the lazygit README demo commit_and_push-compressed.gif is 1140 × 828 px with 67 frames, 63.2 million pixels, so the page refuses it and shows a gifsicle command. That GIF is already optimized; gifsicle -O3 --lossy=80 --colors 128 made it 1% larger, and adding --resize-width 570 cut it from 472,611 to 147,386 bytes.
  • Short delays. Chromium and Firefox play a delay of 0 or 10 ms as 100 ms (Chromium source, Firefox source). The tool writes such frames as 100 ms, so the output plays the same in every viewer. Other delays are rounded to 10 ms steps, with a minimum of 20 ms.
  • Output. Always a GIF with one global color table. Frames cannot be cropped, reordered or edited. To take a GIF apart into PNG frames, use the GIF Splitter. For JPEG, PNG and WebP, use the Image Compressor.
  • Other formats. For photographic motion, animated WebP or MP4 are far smaller. The WebP Converter converts only the first frame of a GIF, so run these on your computer:
gif2webp -lossy -q 75 in.gif -o out.webp
ffmpeg -i in.gif -movflags +faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4

FAQ

Is my GIF uploaded anywhere?

No. The file is read with the File API, decoded and re-encoded by JavaScript on this page, and the result is offered as a download from memory. Only your settings (Lossy, Colors, Frames and Dithering) are saved, in this browser's local storage; Ctrl/⌘+L keeps them, and clearing this site's data in the browser removes them. Width is set per file and is not saved. The page loads Google Analytics and AdSense like the rest of the site. Its usage events hold only the tool name and the action: compress each time a compression finishes (once after a file loads, then once per click on Compress) and download when you click Download GIF.

What does the Lossy slider do?

GIF stores pixels with LZW compression, which saves space when a run of pixels repeats a sequence it has seen before. At Lossy above 0, the encoder may write a pixel as a slightly different palette color when that continues a sequence it already knows. The largest allowed shift is Lossy × 0.6 as a distance in RGB space: 24 at the default of 40, 60 at 100. Between frames, a pixel that is within that distance of what is already on screen counts as unchanged and is not redrawn. Transparent pixels never change. At 0 the pixels are written exactly.

Why is the result sometimes larger than the original?

Some GIFs are already optimized, for example by gifsicle -O3 or by an encoder that gives every frame its own color table. This tool writes one shared palette of up to 255 colors plus a transparent slot, so a GIF that uses 256 colors, or different colors per frame, must be re-quantized and can grow. The rotating Earth GIF from Wikimedia Commons grows to 105% at Lossy 0. When that happens, the page says so and you can still download the file. Lower Colors, raise Lossy or reduce the width to get a smaller file.

Why is Dithering off by default?

Dithering scatters pixels of neighboring palette colors to fake the colors the palette lacks. The scattered pattern changes from frame to frame even where the picture stands still, so far fewer pixels count as unchanged and LZW finds fewer repeats. On the Newton's cradle GIF at 16 colors and Lossy 0, the output was 149,326 bytes without dithering and 514,523 bytes with it, 1.67 times the original file. Turn it on for smooth gradients at low color counts, where banding is worse than the extra bytes.

How large a GIF can it handle?

Up to 50 million decoded pixels (width × height × frames), 1,000 frames, and 16,777,216 pixels per frame (16,384 px per side). Decoded frames are held in memory as RGBA, so 50 million pixels is about 200 MB, which a phone browser can still hold. A larger file is refused before decoding starts, and the page shows a gifsicle command to run locally instead.