Compression GIF
Fast, accurate and free online compression gif tool running directly in your browser.
-
1Enter data
Enter content, paste text or load a file from disk. -
2Click the button
The tool will immediately process your data in the browser. -
3Get the result
Copy the finished text or save the file to your device.
return "Result ready in 0.1s";
}
Kompresja GIF
Rate this tool:
Related tools
Other tools you may find usefulGIF compression online. Reduce animations without losing meaning and smoothness
This tool compresses GIF files using the gifsicle binary and sensible presets. You set the number of colors, optimization level and possible lossiness, and the module returns a lighter GIF while preserving key frames. It works in batches, shows previews, counts savings and gives you a download link.
What the tool can do and when to use it
GIF compression is useful in mailings, on landing pages and in applications where the animation must weigh as little as possible. This module processes multiple files simultaneously, adjusts the color palette, optimizes frame redundancy and enables lossy artifact reduction. On the UI side, you get a file selection box, parameter settings and a clear results table with a preview. On the server side, there is type and size validation, temporary file management and writing to public storage with a direct URL.
- Batch GIF compression without user-side installation.
- Adjust the color palette from 2 to 256.
- Three levels of optimization, from fast to aggressive.
- Lossy mode with control on a scale of 0 to 200 - precise exchange of quality for weight.
- Thumbnail preview, exact before and after numbers, savings percentage.
How the compressor works underneath
The Livewire component accepts files and updatespreviewsimmediately after upload. Thecompressmethod validates the MIME type ofimage/gifand the maximum weight based on$max_file_size_mb. For each file, therunGifsiclefunction is called, which looks for the gifsicle binary in the environment, builds parameters based on the user's selection, and runs the system command. On failure, there is a fallback to the ImageOptimizer chain. Finally, the result goes to the public drive with a unique name and download link.
// Processing pseudocode
for file in local_files:
temp = storeTemp(file)
before = filesize(temp)
out = temp + ".opt.gif"
ok = runGifsicle(temp, out) // --optimize=N --colors=K [--lossy=M]
if !ok:
try Spatie ImageOptimizer -> optimize(temp)
out = temp
after = filesize(out)
saved = max(0, before - after)
pct = before > 0 ? round(saved/before*100, 2) : 0
path = "tools/gif-compressor/" + uniqid() + "_" + originalName
url = Storage::disk("public")->putFileAndGetUrl(out, path)
pushRow(name, before, after, saved, pct, url)
Map of options and their impact on the result
Number of colors
Range 2 to 256. A smaller palette means smaller files, but potential banding in gradients. For icons and simple animations, 64 to 128 colors are usually sufficient. For screencasts, try 128 to 256 to avoid banding.
Optimization level
Values 1, 2, or 3. Higher levels analyze frames more intensively and remove repetitive pixels. 1 is fast and safe. 2 is a good compromise. 3 maximizes compression at the expense of processing time.
Lossy
Range 0 to 200. 0 means lossless mode. Values of 10 to 40 are usually safe and difficult to notice. Above 80, artifacts and noticeable blurring appear. The parameter acts as a smoothing filter that reduces the number of unique patterns between frames.
Step-by-step instructions
- Upload GIF files by selection or dragging to the designated field. You will see thumbnails and sizes.
- Set the number of colors. A lower value means greater savings - test in the preview.
- Select the optimization level. Initially use 2. For maximum profits choose 3.
- Determine the loss. Leave 0 if you want to keep full quality. Try 20 to 40 to significantly reduce weight without any noticeable drop in quality.
- Click Start Compression and wait for the status to update above the panel.
- Get optimized files from the leaderboard. Check the before and after columns and the savings percentage.
- If necessary, use Clear Results to start a new series.
Interface structure and results table
| Preview | File | Size before | Size after | Saved | % | Download |
|---|---|---|---|---|---|---|
| Thumbnail | hero-animation.gif | 4 512.00 KB | 1 936.00 KB | 2 576.00 KB | 57.10% | Link |
| Thumbnail | tutorial-step2.gif | 2 048.00 KB | 1 126.40 KB | 921.60 KB | 45.00% | Link |
Input parameters, limits and validation
| Field | Description | Range or format |
|---|---|---|
| colors | Target number of colors in palette | 2 to 256 |
| optimize_level | Frame optimization intensity | 1 to 3 |
| losses | Loss level for additional reduction | 0 to 200 |
| max_file_size_mb | Maximum weight of a single file to be accepted | default 50 MB |
| local_files | List of uploaded files subject to compression | mimetypes: image/gif |
Implementation insight
private function runGifsicle($in, $out) {
$bin = $this->gifsiclePath();
if (!$bin || !is_file($in)) return false;
$colors = max(2, min(256, (int)$this->colors));
$opt = max(1, min(3, (int)$this->optimize_level));
$lossy = max(0, min(200, (int)$this->lossy));
$parts = [escapeshellcmd($bin), "--optimize={$opt}", "--colors={$colors}"];
if ($lossy > 0) { $parts[] = "--lossy={$lossy}"; }
$parts[] = escapeshellarg($in);
$cmd = implode(" ", $parts) . " -o " . escapeshellarg($out);
@shell_exec($cmd);
return is_file($out) && filesize($out) > 0;
}
GIF compression best practices
- Reduce the palette only after a quick preview. For materials with gradients, keep 128 to 256.
- Choose optimization 2 for everyday tasks. Reserve level 3 for heavy files and final builds.
- Set the losses in the range of 10 to 40. Above 60, the number of artifacts and posterization increases quickly.
- Take care of the frame rate before exporting from the editor. Less FPS means less weight and shorter processing time.
- If possible, convert GIF to MP4 or WebM on video-supporting websites. When you require a GIF, use this compressor to get the weight as low as possible.
Security and Privacy
Files are processed locally on the server. Temporary copies go to the Livewire directory, and the result is saved on a public drive in the tool's folder. The link is for downloading and can be removed on the project page. Enable results directory rotation in cron to reduce data retention.
FAQ
Does compression change the animation speed
No. The tool does not modify the delays between frames. The changes concern the color palette and optimization of frame content.
Do losses always worsen the quality
Yes, but in a controlled way. At values 10 to 30 the deterioration is difficult to see and the gain in KB is large. Higher levels should be tested against the target background and resolution.
What savings are typical
For typical product gifs 30 to 60 percent. For screencasts 20 to 45 percent. For simple icons and loaders 50 to 80 percent, especially with a smaller palette.
What if the environment does not have a gifsicle
Fallback to the ImageOptimizer chain works. The result will be less aggressive, but still reduced from the original. It is worth installing gifsicle to get the full functionality.
Can I set different parameters for each file
The current interface applies common settings to the entire series. If you want to vary the parameters, divide the files into batches and run the compression multiple times.
Troubleshooting
- Visible color stripes after compression - increase the number of colors or reduce losses.
- Poor frame rate - input material has too low FPS. Compression won't fix it. Consider re-exporting the source.
- The file does not pass validation - check the MIME type and maximum size. The default limit is 50 MB.
- No reduction effect - for minimal gifs without repeating frames the gain may be small. Use level 3 and a slight loss.
This tool simplifies the distribution of animations on bandwidth-limited channels. Always compare the result with the original on the target background and resolution.