Convertio.com

GIF Color Palette: Why 256 Colors Matter

GIF uses 8-bit indexed color, limiting each frame to 256 colors from the full 16.7 million RGB space. The colors you choose for that palette — and how you simulate missing colors with dithering — determine whether your GIF looks professional or terrible. This guide explains palette generation, dithering algorithms, and practical optimization strategies.

Convert MP4 to GIF

Create GIFs with optimal color palettes

MP4GIF

Tap to choose your file

or

Supports M4A, WAV, FLAC, OGG, AAC, WMA, AIFF, OPUS • Max 100 MB

Encrypted upload via HTTPS. Files auto-deleted within 2 hours.

Why GIFs Only Support 256 Colors

The GIF format was designed in 1987 when 256 colors was considered generous for computer displays. It uses 8-bit indexed color: each pixel stores an index (0–255) that references a color in a lookup table (the palette). The palette holds up to 256 colors, each defined as an RGB triplet.

The key insight: those 256 colors can be any 256 colors from the full 16.7 million RGB color space. A GIF of a sunset can use 256 shades of orange, red, and purple. A GIF of a forest can use 256 shades of green. The challenge is choosing the right 256 colors for your specific content.

Why Palette Selection Matters

A generic "web-safe" palette uses a fixed set of 216 colors spread across the spectrum. For video content, this produces terrible results because the colors may not match your video at all.

A custom palette analyzes the actual pixels in your video and selects the 256 colors that best represent the content. The improvement is dramatic — colors look natural, gradients are smoother, and details are preserved.

Our converter uses FFmpeg's two-pass approach: first analyze the video to generate an optimal palette (palettegen), then apply that palette to create the GIF (paletteuse). This produces significantly better results than single-pass tools.

Palette Generation Methods

Full Mode (stats_mode=full)

Analyzes all pixels in all frames to build one global palette. Best for videos with diverse, changing content like film clips, action sequences, and music videos where colors vary across frames.

Diff Mode (stats_mode=diff)

Only counts pixels that change between frames. Better for videos with static backgrounds like screen recordings, presentations, and talking-head videos. Produces smaller files because it allocates more palette entries to the changing content and fewer to the unchanging background.

Single Mode (stats_mode=single)

Creates a new palette for every frame. Provides the highest possible quality since each frame gets an optimized palette, but produces larger files. Best for photographic content where color accuracy is critical.

Color Count Tradeoffs

ColorsQualitySize SavingsBest For
256Best possibleBaselinePhotographic content
128Barely different15–25%Sweet spot for most content
64Slight banding30–45%Screen recordings
32Noticeable posterization45–60%Simple graphics only
16Significant degradation60–75%Logos, pixel art

Dithering: Simulating Missing Colors

Dithering uses patterns of available colors to simulate colors not in the palette. It is the difference between harsh color banding and smooth-looking gradients.

  • No dithering: maps each pixel to the nearest palette color. Fastest, smallest files, but shows visible banding on gradients. Best for flat-color content like logos and pixel art.
  • Bayer (ordered): uses a deterministic crosshatch pattern. The regular pattern compresses well, making it the best choice when file size is critical. Slight visible pattern at close inspection.
  • Floyd-Steinberg (error diffusion): distributes quantization error to neighboring pixels. Produces the most natural-looking results for photographic content. Larger files due to random-looking pixel patterns.
  • Sierra2: enhanced error diffusion with a wider distribution kernel. Produces results between Floyd-Steinberg and Bayer in both quality and file size. Our recommended default.

Recommendations by Content Type

ContentPalette ModeColorsDithering
Screencastdiff128Bayer
Film clipfull256Sierra2
Logo animationfull64None
Photographysingle256Floyd-Steinberg

Modern Alternatives with Better Color Support

If GIF's 256-color limitation is unacceptable for your content, consider these alternatives:

  • WebP animation: 24-bit color (16.7M colors), full alpha transparency, 50–70% smaller than GIF. Supported by 97%+ of browsers.
  • APNG: full PNG quality with 24-bit color and 8-bit alpha. Same browser support as WebP. Best when you need transparency with full color.
  • MP4/WebM: millions of colors, vastly smaller files. Use <video autoplay loop muted playsinline> on websites.

Compare all options in our animated formats comparison.

Try Custom Palette

Create a GIF with optimized color settings

MP4GIF

Tap to choose your file

or

Supports M4A, WAV, FLAC, OGG, AAC, WMA, AIFF, OPUS • Max 100 MB

Frequently Asked Questions

GIF's 256-color limit causes visible banding in smooth gradients. Enable dithering (Sierra2 or Floyd-Steinberg) to simulate additional colors using pixel patterns.

Use "full" for videos with diverse, changing content (film clips, action). Use "diff" for videos with static backgrounds (screen recordings, talking head) — it produces smaller files.

128 colors is the sweet spot: 15–25% smaller than 256 with barely visible difference. For simple animations, 64 colors works well. Drop to 32 only for very simple content like logos.

Sierra2 for general use. Floyd-Steinberg for photographic content with gradients. Bayer for smallest file sizes (screen recordings, emoji). No dithering for flat-color logos.

More MP4 to GIF Guides

How to Convert Video to GIF: Complete Guide
Convert MP4, MOV, WebM to GIF online free. Five methods: online converter, FFmpeg, Photoshop, mobile apps, screen recording.
GIF vs MP4: Which Format Should You Use?
GIF vs MP4 compared: file size, quality, browser support, email, Core Web Vitals. When to use each format.
GIF Quality Settings: How to Make Better GIFs
Master GIF settings: FPS, resolution, color palette, dithering. Create high-quality GIFs with optimal file sizes.
How to Reduce GIF File Size: 7 Proven Methods
Shrink GIF files by 50-90%. Resolution, FPS, colors, dithering, and when to switch to MP4 or WebP.
GIF Frame Rate Guide: What FPS Should You Use?
Choose the right GIF frame rate: 5-20 fps recommendations by content type. File size impact and speed control.
GIF Size Limits for Discord, Slack, Twitter & Email
Complete GIF size limits for every platform. Discord 8 MB, Slack emoji 128 KB, Twitter 15 MB, and optimization presets.
Animated GIFs in Email: Best Practices & Size Guide
Email GIF best practices: under 500 KB, Outlook first-frame issue, client support, and optimal settings.
GIF Loop Settings: Infinite, Play Once & Custom
GIF loop count explained: infinite, play once, custom loops. Browser behavior differences and email best practices.
How to Make GIFs for Discord: Chat, Emoji & Server Icons
Create Discord GIFs: 8 MB chat limit, 256 KB emoji, animated server icons. Step-by-step with optimization presets.
Animated Formats Compared: GIF vs WebP vs APNG vs MP4
Compare GIF, WebP, APNG, and MP4 for animations. File size, quality, browser support, and decision flowchart.
Back to MP4 to GIF Converter