Does Reordering a GIF Palette Make It Smaller?
Not in our fixed-table test: moving four colors from indices 0–3 to 252–255 saved 0 bytes. Both GIFs were 1,913 bytes and decoded to the same animation. A local run of the GIF compressor engine produced the same 580-byte output from either input. That reduction is the result of re-encoding and optimization; it is not evidence that one palette order compressed better.
Measured October 30, 2026. Own CC0 synthetic inputs and figures. The four engine runs below are local; one actual website download is verified separately. Full-frame pixels, stored delays, looping and dimensions were checked from saved files locally. We did not measure subjective visual quality or real-time browser playback.
A palette label is not a color count
A GIF image stores palette indices. Changing an index without changing the corresponding palette entry can change the displayed color. Our control instead applies a one-to-one relabeling: we move the four used RGB colors and remap every corresponding pixel. The logical background index is remapped too. The visible animation stays the same.
Both inputs have one 256-slot global color table occupying 768 bytes, no local tables and an LZW minimum code size of 8 in each frame. One uses slots 0–3; the other uses 252–255. Neither removes a color, shrinks the table, changes the minimum code size, adds transparency, changes disposal, or removes a frame. This keeps the question narrower than “can optimizing a palette reduce GIF size?”
| Variant | Used indices | Input | Local lossless | Local default |
|---|---|---|---|---|
| Low labels | 0–3 | 1,913 B | 580 B | 580 B |
| High labels | 252–255 | 1,913 B | 580 B | 580 B |

What did we keep fixed?
Each input contains four opaque, non-interlaced, full-canvas 96 × 56 frames with disposal 1. Stored delays are 100, 150, 200 and 250 milliseconds; the loop value is 0, meaning infinite looping. The four RGB colors are (248,245,232), (24,103,76), (201,90,50) and (58,95,161). We used the same Pillow encoder settings with optimization disabled when creating the paired inputs.
The input file hashes differ, as expected after remapping the palette, pixels and background index. Their equal lengths alone would not establish equal animation. We separately decoded the saved files and compared full RGBA frame sequences, rather than relying on file size, preview appearance, frame rectangles or palette length.
Why did higher labels not make this file bigger?
LZW builds phrases from symbol sequences. For a consistent one-to-one renaming with the same initial code width and encoding decisions, repeated patterns remain repeated patterns. A larger numeric palette label does not automatically require a wider code when both images already use the same minimum code size. This is an explanation of the controlled result, not a claim that every encoder always makes identical decisions.
The GIF89a specification describes the color table, its sort flag and LZW minimum code size separately. A sorted table can help a decoder choose colors when it cannot display the entire table; the sort flag is not itself a command to compress image data. Removing unused slots and lowering the required code size would be additional changes, outside this paired control.
What changed during compression?
We ran the engine shipped with SlimGIF locally. The lossless command was -O1 input.gif -o /out/output.gif; the default command added --colors 128 --lossy=30. Neither resized the input. Within each setting, the low-index and high-index outputs were byte-identical at 580 bytes. On this four-color fixture, the default and lossless outputs were also the same.
Pillow and FFmpeg independently decoded all six files. Within each decoder, both inputs and all four outputs have matching complete RGBA frame sequences. The verification also checks stored delays and dimensions; the GIF loop field was checked locally. Matching full-frame pixels is stronger evidence than matching frame counts, but it still does not measure actual display timing in a browser or establish general visual-quality performance.
We separately selected the high-index input on the real SlimGIF website in the in-app browser, with 128 Colors, lossy 30 and dimensions 100%. Its actual downloaded file is 580 bytes and byte-identical to the local high-default output. The downloaded bytes therefore have the same locally verified frames and timing. This verifies one website download, not four browser runs. Analytics remained rejected. See the download verification record and actual saved download.

Is this the same as sharing or reducing a palette?
No. Our global-versus-local palette test changes how many color tables are stored. Our per-frame color test changes the colors available across an animation. This experiment keeps the table count, table capacity and displayed colors fixed while changing their index labels. Do not use it to claim that removing unused entries, quantizing colors or sharing tables cannot help.
Should I manually sort a palette before using a GIF compressor?
There is no measured benefit to that extra step in this example. Keep the original, run a lossless baseline, then inspect the saved output. If you reduce colors or dimensions later, compare those changes separately. Palette remapping can also damage transparency or a background reference if only the color table is edited and dependent indices are left untouched.
An indexed-image question on Stack Overflow asks how to move a color to index 0 while keeping the picture unchanged. That question concerns PNG, not GIF compression; it illustrates the remapping problem, not demand or performance evidence for this GIF compressor.
Download and reproduce the control
- Inputs: low-index GIF and high-index GIF.
- Local outputs: low lossless, high lossless, low default and high default.
- Methods: file hashes and verification, engine commands, FFmpeg record, fixture and verification script, local engine runner and CC0 and reproduction notes.
These are deliberately simple synthetic files. The observed zero-byte difference does not predict every encoder, export workflow or real GIF. One separate real website download matches the local default output; the complete four-run matrix remains a local experiment. For a different fixed-payload control, see GIF data sub-block overhead. Return to the GIF compressor to compare your own file.
Can code width change size with a fixed palette? See our LZW minimum code size controlled experiment.

Watch the palette-reordering explanation: SlimGIF original narrated test (published October 31).