← Back to blog

How to Compress GIFs Smaller: 6 Methods Ranked by Image Quality Loss

Exported a 5-second demo to GIF, only to find it's 18 MB. Uploading fails or takes ages. Why is an animated image bigger than a video? Here's how to shrink it without ugly noise.

Share

Recorded a 5-second demo and exported it as a GIF. The file size is 18 MB.
Want to paste it into a document, send it in a group chat, or put it in a README? It either fails to upload or spins for ages.
Why is an "animated image" bigger than a video? And how do you shrink it without it turning into a screen full of noise?


First, Understand Why GIFs Are So Big

The GIF format dates back to 1987, and several of its inherent settings determine why it is "fat":

  • Every frame is a complete image. Unlike video, which uses "inter-frame" compression to record only changes, a standard GIF exports every frame as a full image. Unless export settings are specifically optimized, 100 frames means 100 images.
  • The compression algorithm is old. GIF only uses LZW lossless compression, which is good at "continuous identical colors" but struggles with gradients, photos, and fine textures.
  • Max 256 colors per frame. When color depth is insufficient, export tools use "dithering"—using a dense field of speckled noise to simulate transitions. These noise points may look smooth to the human eye, but they are the hardest data for LZW to compress.

Therefore, a GIF's file size is roughly determined by: Resolution × Frame Count × How "busy" each frame is. The methods below all target these three factors.

Six Methods, Ranked by Image Quality Loss

1. Frame Optimization: Save Only the "Changed Parts" (Lossless)

Many screen recording tools and design software export GIFs where every single frame contains the entire screen. However, in an operation demo, usually only the mouse pointer and a small area are moving.

Frame optimization does this: For each frame, it only retains the rectangular area that differs from the previous frame, using transparent pixels for the unchanged parts. These transparent pixels form a solid block, making them highly efficient for LZW compression.

The visual result is identical to the original animation—pixel for pixel—just stored more efficiently. For GIFs with a static background and moving parts (screen recordings, UI demos, memes), this step can save a significant amount of space.

2. Lossy LZW: "Loosen the Ties" in the Compression Algorithm (Visually Lossless)

This approach comes from the --lossy parameter in gifsicle: during encoding, it allows for extremely slight color deviations, letting more pixels be treated as "the same color". This dramatically increases LZW efficiency.

Its characteristics are: no reduction in color count, no size change, no frame change. The trade-off is a slight graininess appearing in the image. The higher the value, the more compression, and the more obvious the grain. When used lightly (e.g., --lossy=30~40), it is often hard to notice at a normal viewing distance.

3. Color Reduction: Drop from 256 to 128 or 64 Colors

Reducing the color palette from 256 to 128 or even 64 colors means each pixel carries less information, which improves compression efficiency.

For flat illustration, icon animations, and UI screen recordings where colors are limited, reducing colors causes almost no loss. However, for photographic or gradient-heavy scenes, color reduction will result in obvious color banding and blotches.

4. Frame Skipping: Lower Frame Rate

Many GIFs are exported at 30 fps or even 60 fps, but GIFs are not optimized for high frame rates; in many scenarios, 10~15 fps is sufficient.

Halving the frame count typically reduces the file size by about half. The trade-off is less smooth motion—this is negligible for operation demos but noticeable for animations requiring smoothness.

5. Resize

File size is roughly proportional to the number of pixels. Scaling the width and height by half reduces the pixel count to one quarter.

Recordings on Retina screens often have an original width of over 2000 pixels, yet they are ultimately displayed within a 600~800 pixel width. Exporting at the actual display size is often the most effective step. The trade-off is that the image may look blurry when enlarged; be mindful of readability if the content includes small text.

6. Switch Format: Change GIF to Video or WebP

If the platform allows, the most thorough method is to not use GIF at all:

  • MP4 / WebM: Modern video codecs use inter-frame compression, so the same content is often only a fraction of the size of a GIF. You can achieve the same effect as a GIF on the web using <video autoplay loop muted playsinline>.
  • Animated WebP / APNG: Supports more colors and better compression and is supported by modern browsers.

The trade-off is compatibility: many chat apps, forums, document tools, and email clients only recognize GIFs. Switching formats might mean the image simply doesn't display, or won't autoplay automatically.


A Table to See the Trade-offs

Method Visual Impact Good For Not Good For
Frame Optimization None, pixels unchanged All GIFs, especially screen recordings and partial animations — (should always be done)
Lossy LZW (Light) Slight graininess Most GIFs Pixel art sensitive to grain
Color Reduction Banding in gradients Flat illustrations, icons, UI Photos, gradient-heavy scenes
Frame Skipping Motion becomes choppy Operation demos, mostly static animations Animations needing smoothness
Resize Details are lost Original image significantly larger than display size Content requiring small text legibility
Switch Format Usually better Web, platforms you control Platforms that only accept GIFs

The logic of the order is: start with methods that don't lose or lose almost nothing, then proceed as needed. If the first two steps are sufficient, there is no need to sacrifice color count, frame rate, or size.


Step 1 & 2: Let ImgZilla Handle Them for You in Batch

If you have a pile of GIFs—meme collections, demo GIFs in documents, website asset directories—manually adjusting parameters in online tools one by one is exhausting.

ImgZilla is a macOS image compression tool that handles the first two methods in the table above:

  • Based on gifsicle: It performs the highest level of frame optimization first (equivalent to -O3), then applies a light lossy LZW (equivalent to --lossy=40).
  • No color reduction, no frame skipping, no resizing, no loop setting changes. The animation remains exactly the same; frame rate, duration, and resolution are unchanged, only the file size is smaller.
  • Local compression: File name, path, and format remain unchanged. demo.gif in a document, web page, or Markdown remains demo.gif after compression; no links need to be updated.
  • Drag and drop the entire folder: It recursively scans subdirectories and processes GIFs along with JPG, PNG, WebP, etc.
  • Won't force compression on already optimized files: Files that have already been optimized to a compression rate below 0.4% are marked as "minimized" and left as-is, and do not consume your free quota.
  • Originals moved to Trash by default: If you aren't satisfied with the result, right-click "Put Back" to restore it.
  • Runs entirely locally: No data is uploaded to any server, and there are no limits on single file size or total quantity found in online tools—tens of MB screen recording GIFs are processed with ease.

How much you save depends on how the GIF was originally exported. GIFs that haven't been optimized for frames and have mostly static content typically save the most; GIFs already compressed by professional tools may only have a tiny margin left, or even be marked directly as "minimized"—this is normal.

What ImgZilla Won't Do

To ensure "the animation looks unchanged," ImgZilla will not perform steps 3 through 6 for you. If the first two steps are still too large—for example, if you must compress to fit within a platform's upload limit—you will need to decide what to sacrifice yourself:

bash

Using the gifsicle command line: reduce to 128 colors, resize width to 640, stronger lossy compression

gifsicle -O3 --lossy=80 --colors 128 --resize-width 640 input.gif -o output.gif

Use ffmpeg to convert GIF to MP4 (usually much smaller file size)

ffmpeg -i input.gif -movflags +faststart -pix_fmt yuv420p
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4

For frame skipping or trimming duration—operations that require selecting frames manually—online editors like ezgif are more intuitive.


A Better Habit: Don't Export Huge GIFs at the Source

The final three tips will save you from compressing GIFs many times in the future:

  1. Resize the window before recording, recording only the needed area instead of the entire Retina screen.
  2. Choose 10~15 fps when exporting; most demos are sufficient.
  3. Compress after export, doing the frame optimization and light lossy compression—this step doesn't require judgment and is suitable for batch processing by tools.

GIF is an old format, but it remains the "greatest common divisor" for "autoplay everywhere". Instead of agonizing over whether to abandon it, let every GIF occupy only the space it needs.

ImgZilla is currently only available for macOS (12.3 and above) and can be downloaded from the Mac App Store. The free version compresses 10 GIFs per day, with only successful compressions counting toward your quota—drag your GIF-filled folder in and see how much space you save.
}

Want smaller, faster images?

Download ImgZilla and compress locally — your images never leave your Mac.