Convert MP4 to GIF — Free Online Tool
Convert MP4 video files to animated GIF format directly in your browser — no upload required. The conversion encodes your video frames using the GIF codec's 256-color palette, producing a looping animation ideal for sharing short clips on platforms that don't support video embeds.
to
FFmpeg Command
Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg
Drop your MP4 file here
or click to browse
Free — no uploads, no signups. Your files never leave your browser.
Settings
Note: Browser-based encoding uses approximate quality targets. For precise CRF compression, copy the FFmpeg command above and run it on your desktop.
Estimated output:
Conversion Complete!
DownloadHow It Works
During this conversion, FFmpeg decodes the H.264 (or other video codec) stream from the MP4 container frame by frame, then re-encodes each frame using the GIF format's indexed color model. Because GIF supports a maximum of 256 colors per frame, the encoder must perform color quantization — mapping the full-color video palette down to the closest 256 colors. Audio is completely dropped, as GIF has no audio support whatsoever. The result is a silent, looping animation. This is a full re-encode, not a remux, so processing time scales with the length and resolution of your clip. Longer or higher-resolution videos will produce very large GIF files because GIF compression (LZW) is far less efficient than modern video codecs like H.264.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg program. In this browser-based tool, it runs via FFmpeg.wasm (WebAssembly), so no installation is needed — the same command can be run identically in a local terminal if you have FFmpeg installed on your machine. |
-i input.mp4
|
Specifies the input file — in this case, your source MP4 container, which may contain H.264, H.265, or VP9 video along with audio and subtitle tracks. FFmpeg will read and decode all streams, though only the video stream is used for GIF output. |
-c:v gif
|
Sets the video codec to GIF, instructing FFmpeg to encode every decoded video frame into GIF's indexed 256-color format. This is a full re-encode from the compressed video codec (e.g., H.264) into the GIF bitmap format — no stream copying is possible here. |
-loop 0
|
Sets the GIF loop count to infinite (0 means loop forever), which is the standard behavior for animated GIFs displayed in browsers and on social platforms. Without this flag, the GIF would play through once and stop on the last frame. |
output.gif
|
Specifies the output filename and container format. The .gif extension tells FFmpeg to wrap the encoded frames in a GIF file. The resulting file contains only the animated video frames — all audio from the source MP4 is automatically discarded because the GIF format has no audio support. |
Common Use Cases
- Share a short product demo or UI interaction on platforms like GitHub READMEs, Jira tickets, or Confluence pages that render GIFs but not video embeds
- Create a looping reaction clip from a recorded video to use in messaging apps or forums that support GIF but not MP4
- Export a brief animated illustration or motion graphic from an MP4 to embed in an email client that blocks video playback
- Convert a short gameplay highlight or screen recording into a GIF for posting to Reddit, which auto-plays GIFs inline in feeds
- Produce a looping animated thumbnail or banner from a video clip for use on a website without requiring a video player
- Extract a repeating visual loop — such as a loading animation or cinemagraph — from an MP4 source for use in a design asset library
Frequently Asked Questions
This is expected and fundamental to how the two formats work. MP4 with H.264 video uses highly efficient temporal compression — it stores only the differences between frames. GIF uses LZW compression, which is far less efficient and effectively stores each frame as a full indexed image. A 10-second MP4 at 1080p might be a few megabytes, while the same clip as a GIF could easily be 50–200MB or more. To keep GIF sizes manageable, it is strongly recommended to trim your clip to under 5 seconds, scale the resolution down to 480px wide or less, and reduce the frame rate to 10–15 fps before converting.
Yes. The FFmpeg command includes the flag '-loop 0', which sets the GIF to loop indefinitely. This is the standard behavior expected for animated GIFs on the web. If you run the command locally and want the animation to play only once, change '-loop 0' to '-loop 1'. Note that loop count values in GIF are slightly counterintuitive — '0' means infinite, while '1' means play once with no repeat.
GIF is limited to a palette of 256 colors per frame, whereas the original MP4 likely contains millions of colors rendered by H.264 or H.265. During conversion, FFmpeg must quantize the full-color video down to the nearest 256 colors using a generated palette, which causes visible color banding and dithering artifacts — especially in gradients, skin tones, and subtle shadows. Clips with flat colors or simple graphics tend to look much better as GIFs than photorealistic footage. For better quality with the FFmpeg CLI, you can use a two-pass approach with the 'palettegen' and 'paletteuse' filters to generate an optimized per-clip palette.
No. GIF is a purely visual format with no audio container or codec support — it is technically impossible to embed audio in a GIF file. All audio tracks from the source MP4 are silently discarded during conversion. If you need a short looping visual with sound, consider converting to WebM or MP4 with the 'loop' attribute instead, which browsers can play with audio.
You can add video filters to the command to scale down the resolution and limit the frame rate. For example: 'ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1:flags=lanczos" -c:v gif -loop 0 output.gif'. The 'fps=10' filter reduces the frame rate to 10 frames per second, and 'scale=480:-1' resizes the width to 480 pixels while preserving the aspect ratio. The 'lanczos' flag uses a high-quality downscaling algorithm. These two adjustments alone can reduce GIF file size by 80% or more compared to converting at original resolution and frame rate.
Yes, and this is highly recommended since GIF files grow very quickly in size. Add '-ss' (start time) and '-t' (duration) or '-to' (end time) flags to the FFmpeg command. For example: 'ffmpeg -ss 00:00:05 -t 3 -i input.mp4 -c:v gif -loop 0 output.gif' extracts just 3 seconds starting at the 5-second mark. Placing '-ss' before '-i' uses fast seek and is more efficient for large files. Keeping your GIF source clip under 5 seconds is strongly advised to avoid producing an unmanageably large output file.
Technical Notes
GIF (Graphics Interchange Format) was introduced in 1987 and uses LZW lossless compression — but its 256-color-per-frame limit makes it perceptually lossy for photographic or video content. FFmpeg's built-in GIF encoder uses a single global palette derived from the first frame or averaged across the clip, which is why colors can look poor on varied footage. For higher quality output via the command line, a two-pass palettegen/paletteuse filter chain generates a per-clip optimized palette and supports dithering algorithms (e.g., Floyd-Steinberg) that significantly improve visual quality at the cost of slightly larger file size. The GIF format supports frame-level transparency (a single transparent color index), but this tool does not extract or map transparency from the MP4 source since MP4 with standard codecs like H.264 does not carry an alpha channel. Metadata such as chapter markers, subtitle tracks, and multiple audio tracks present in the source MP4 are all discarded — GIF supports none of these features. File sizes for animated GIFs converted from video are routinely 10–50x larger than the equivalent MP4, making it critical to crop, scale, and trim aggressively before conversion.