MP4 to GIF Converter
Turn any video clip into a smooth, high quality animated GIF. Trim the exact range, set frame rate and width, even reverse playback, and download, powered by a real FFmpeg engine running fully inside your browser.
Click or drop an MP4, MOV or WEBM file
How this MP4 to GIF converter builds its palette, and why that matters more than the resolution slider
A GIF is not a compressed video. It is an indexed image format capped at 256 colors per frame, defined by the original 1987 GIF89a specification. Feed a busy video clip straight into a naive converter and you get banding, muddy skin tones and dithering noise, because a single global palette of 256 colors is being forced onto footage that easily contains millions. This tool avoids that by running FFmpeg’s two pass palette workflow, the same approach professional command line pipelines use, rather than a one shot color reduction.
The engine behind it is ffmpeg.wasm, a real build of FFmpeg compiled to WebAssembly and run inside a Web Worker in your browser. Your clip is read with FileReader logic wrapped in fetchFile(), written into FFmpeg’s in-memory virtual filesystem, processed there, and read back out as a GIF blob. The video file never leaves your machine. There is no upload, no server processing and no queue.
The two pass conversion
Every conversion runs as two separate FFmpeg commands against the same trimmed segment of your source clip.
-ss and -t. The frame rate and width settings build an FFmpeg filter string: fps=N,scale=W:-1:flags=lanczos. Lanczos resampling is used for the resize because it preserves edge sharpness better than bilinear scaling, which matters once the frame gets reduced to a tiny palette next.
palettegen filter analyzes every frame in the trimmed range and builds one optimal 256 color palette for the whole clip, using stats_mode=diff so the palette favors colors that actually change between frames rather than wasting slots on a static background.
paletteuse=dither=sierra2_4a. Sierra 2 4A error diffusion spreads the rounding error from each mapped pixel into its neighbors, which is what keeps gradients looking smooth instead of banded.
-loop flag to 0 for infinite looping or -1 to play once, and the reverse checkbox appends a reverse filter before encoding. The result is read out of the virtual filesystem as a raw byte array and wrapped in a Blob with an image/gif MIME type.
Because everything runs client side inside a WASM worker, the first conversion on any page load pays a one time cost of roughly 30 MB to fetch the FFmpeg core script and its WebAssembly binary from a CDN. The browser caches those files, so a second clip on the same session converts immediately without a download again.
The controls and their real limits
Every slider in this tool maps directly to a value the code clamps before it ever reaches FFmpeg, so you cannot accidentally submit a setting that would hang the browser tab.
| Control | FFmpeg flag | Clamped range |
|---|---|---|
| Trim duration | -t | 0.5 to 30 seconds |
| Frame rate | fps filter | 5 to 30 fps |
| Output width | scale filter | 80 to 960 pixels, height auto |
| Loop | -loop | 0 (infinite) or -1 (once) |
| Direction | reverse filter | forward or reversed |
Two things worth knowing before you convert
Worker origin fix
ffmpeg.wasm normally tries to build its background Worker straight from the CDN URL its core script loaded from, which browsers block as a cross origin script violation. This tool fetches that worker chunk as a same origin blob first, then hands it to FFmpeg’s loader as classWorkerURL, which is what lets the whole pipeline run without a page reload error.
Single global palette
Because one palette covers the entire clip rather than one per frame, footage with fast, dramatic color shifts, like a scene cut mid clip, will show more compromise than a visually stable clip. Trimming to a single continuous shot gives palettegen an easier job and a cleaner result.
Encoding references and alternatives
- GIF89a specification, the format definition this tool’s output conforms to, including the loop extension block.
- FFmpeg palettegen and paletteuse filter docs, covering
stats_modeand every dithering algorithm available besides Sierra 2 4A. - ffmpeg.wasm documentation, the WebAssembly port of FFmpeg this tool runs in a browser Worker.
- MDN Web Workers API, the browser mechanism that keeps the encoding off the main thread so the page stays responsive.
Where GIFs still win
Turning a screen recording into a looping GIF for a bug report, pulling a reaction clip out of a longer video for a chat app, building a lightweight product demo for a README or landing page where autoplaying video is unwelcome, and preparing short looping clips for platforms that block MP4 uploads but accept GIF. Because the trim range is capped at 30 seconds, this tool is built for short highlight loops, not full scene exports.
FAQ: MP4 to GIF Converter
Upload your MP4, MOV or WEBM file, set the start time and duration for the section you want, choose a frame rate and width, then click Convert to GIF. The tool trims the clip and encodes it into an animated GIF using a two step color palette for the best possible quality.
GIF file size scales with duration, frame rate, and pixel width. Unlike MP4, there is no modern inter frame compression, so every frame is stored close to independently. Trim to just the seconds you need, lower the fps to 10 to 15, and keep the width at 480px or below for social or chat use to keep files small.
256 colors is a hard limit of the GIF format itself, not a limitation of this tool. This converter uses FFmpeg’s palettegen and paletteuse two step workflow with Sierra dithering to make the most of those 256 colors, which noticeably reduces banding compared to a single pass conversion.
This tool caps duration at 30 seconds per conversion to keep processing times and file sizes reasonable inside a browser tab. For longer animations, convert several shorter segments, and note that most platforms, chat apps and forums, impose their own GIF size limits regardless.
It flips the frame order of your selected clip before the palette is generated, so the GIF plays backward from end to start. It is a fun way to create a rewind effect, and combines with looping so the reversed clip repeats seamlessly.
No. The conversion runs on ffmpeg.wasm, a WebAssembly build of FFmpeg executing entirely inside your browser tab. Your video file stays on your device the whole time.
From the blog
Format guides and gotchas
What each format stores, and what quietly disappears in conversion.