User Rating 0.0
Total Usage 0 times
Drop a GIF here or click to browse Max 50 MB • GIF files only
Is this tool helpful?

Your feedback helps us improve.

About

GIF files use the LZW compression algorithm over a palette of up to 256 indexed colors per frame. File size is governed by three factors: the number of colors in the Global or Local Color Table (N), pixel dimensions (W × H), and the total frame count (F). Reducing any one of these parameters decreases file size, but introduces quantization artifacts, spatial aliasing, or temporal stutter respectively. Misapplying these reductions produces banding in gradients, loss of fine detail, and choppy animation. This tool decodes each frame from the raw GIF89a binary, applies Median Cut color quantization, optional Floyd-Steinberg or ordered dithering, bilinear resolution scaling, and frame subsampling, then re-encodes a standards-compliant GIF.

The relationship between color count and palette bits is b = ceil(log2(N)), where b ranges from 1 to 8. Lower b improves LZW compression ratios because fewer distinct codes appear in the stream. Dithering trades spatial noise for perceptual color depth, a necessary compensation when dropping below 64 colors. This tool processes entirely in-browser using a Web Worker. No data leaves your device. Approximations arise from the Median Cut algorithm, which partitions the RGB cube rather than finding a globally optimal palette. For photographic GIFs, expect diminishing returns below 32 colors.

gif quality gif optimizer gif compressor reduce gif size gif color depth gif dithering gif editor

Formulas

The GIF palette size in bits determines the minimum LZW code width and directly affects compression efficiency:

b = ceil(log2(N))

where b = bits per pixel (palette bit depth, range 1 - 8), N = number of colors in the quantized palette.

Uncompressed frame data size before LZW encoding:

Sframe = W × H × b

where W = width in pixels, H = height in pixels. Total raw data across all retained frames:

Stotal = Sframe × ceil(Fk)

where F = original frame count, k = frame keep interval (1 = all, 2 = every other, 3 = every third).

Floyd-Steinberg error diffusion distributes the quantization error e = cold cnew to neighboring pixels with the kernel:

716 right, 316 below-left, 516 below, 116 below-right

where cold = original pixel color channel value, cnew = nearest palette color channel value. Resolution scaling uses bilinear interpolation, sampling the four nearest source pixels weighted by fractional distance.

Reference Data

ColorsPalette BitsTypical Size ReductionVisual ImpactBest Use Case
25680% (baseline)NoneOriginal quality preservation
12875 - 15%MinimalSubtle optimization
64615 - 30%Minor banding in gradientsWeb thumbnails
32530 - 50%Noticeable on photosIcons, simple animations
16445 - 65%Strong posterizationFlat-color graphics, logos
8360 - 75%Heavy color lossMonochrome-like art
4270 - 85%Extreme reductionRetro/pixel art effects
2180 - 90%Binary (two colors)Black & white silhouettes
Resolution Scaling Effects
Scale 100%0%NoneOriginal dimensions
Scale 75%40 - 45%Slight softeningEmail/messaging
Scale 50%70 - 75%Noticeable downscaleInline chat reactions
Scale 25%90 - 94%Major detail lossMicro-thumbnails
Dithering Modes
NoneBest compressionHard bandingFlat-color source
Floyd-SteinbergModerate compressionOrganic noise patternPhotographic GIFs
Ordered (Bayer 4×4)Good compressionRegular dot patternRetro aesthetic
Frame Rate Effects
Keep all frames0%Smooth animationQuality priority
Drop every 2nd50%Slight stutterSize priority
Drop every 3rd33%Choppy on fast motionBalanced

Frequently Asked Questions

The GIF format stores each pixel as an index into a color table of up to 256 entries. Reducing from 256 to 32 colors drops the palette bits from 8 to 5, which means fewer distinct LZW codes appear in the compressed stream, yielding 30-50% smaller files. However, colors not in the reduced palette get mapped to the nearest available color, causing posterization (visible banding) in gradients. Enabling Floyd-Steinberg dithering mitigates this by diffusing quantization error across neighboring pixels, preserving the illusion of more colors at the cost of a slight noise pattern and marginally larger file size due to reduced LZW compressibility of dithered data.
Floyd-Steinberg is an error-diffusion algorithm that distributes quantization error to adjacent unprocessed pixels using a weighted kernel (7/16, 3/16, 5/16, 1/16). It produces organic, film-grain-like noise and generally looks better on photographic content. Ordered dithering uses a fixed Bayer matrix (4×4 in this tool) to apply a threshold pattern, creating a regular dot grid. Ordered dithering compresses better under LZW because the regular pattern produces more repeating sequences. Choose Floyd-Steinberg for visual fidelity, ordered for smaller output files or a deliberate retro aesthetic.
GIF frames use disposal methods and may contain only the changed region (delta frames). If frames are delta-encoded, removing every second frame may actually require the remaining frames to store more pixel data to represent the full image, partially offsetting the savings. Additionally, the GIF header, Global Color Table, and extension blocks remain constant regardless of frame count. For a 10-frame GIF with minimal inter-frame change, dropping 5 frames might only reduce size by 35% rather than 50%. The frame delay values are automatically doubled to maintain perceived animation speed.
Yes, multiplicatively. Scaling to 50% reduces pixel count by 75% (both dimensions halved: W/2 × H/2 = WH/4). Combined with reducing colors from 256 to 32, you achieve both fewer pixels per frame and fewer bits per pixel. A GIF that is 500KB at 256 colors and 100% scale might drop to approximately 60-80KB at 32 colors and 50% scale. However, downscaling introduces interpolated colors that may not exist in a reduced palette, so quantization artifacts can be more pronounced on downscaled images. Applying dithering after scaling compensates for this.
The GIF89a specification limits dimensions to 65,535 × 65,535 pixels, but practical browser memory constraints are the real limit. This tool processes frames on an OffscreenCanvas inside a Web Worker. For typical devices with 4-8GB RAM, expect reliable performance up to approximately 1920 × 1080 pixels with 200 frames (roughly 15 seconds at 13fps). GIFs exceeding 50MB input size are rejected to prevent memory exhaustion. Each frame decoded to RGBA requires W × H × 4 bytes, so a 1000 × 1000 × 100 frame GIF uses approximately 400MB of working memory during processing.
In GIF encoding, the LZW minimum code size is set to the palette bit depth (with a floor of 2). A 256-color palette uses minimum code size 8, meaning initial codes are 9 bits. A 4-color palette uses minimum code size 2, with initial codes at 3 bits. Smaller initial codes mean the LZW dictionary fills more slowly and codes stay shorter for longer, producing a more compact stream. This is why reducing colors has a disproportionately large effect on file size compared to what the palette table size alone would suggest.