← Back to articles
Quanlai Li

How to Turn a Video Into a GIF (2026)

Turn any video into a sharp, small GIF: pick the clip, set frame rate and width, handle the 256-color palette, and convert with ffmpeg, a phone, or online.

Try it now

Quick Answer: Trim the video to 2 to 6 seconds, drop the frame rate to 10 to 15 fps, and scale the width to 480 to 640 pixels. Then convert with a tool that builds a custom palette for your clip, because a GIF frame holds at most 256 colors. With ffmpeg, the reliable one-liner is ffmpeg -ss 1 -t 3 -i input.mp4 -vf "fps=12,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif. If the GIF is still too big for where it is going, shorten it, shrink it, or send a muted MP4 instead.

Video frames on the left feeding into the 256-color palette ffmpeg built for the same clip A GIF keeps your frames but maps every pixel onto at most 256 colors.

Why GIFs Get Big (and Ugly) So Fast

A GIF is a stack of full images played in sequence. It has no modern video compression, so every extra second, every extra frame per second, and every extra pixel of width adds directly to the file. A 3-second clip at 30 fps is 90 separate pictures. Cut it to 12 fps and you are down to 36.

The second constraint is color. The GIF89a format (the W3C-hosted specification is the reference) stores each frame against a color table of at most 256 entries. A video frame can contain millions of colors. Whatever converter you use has to pick 256 of them and map everything else onto that set. Picking well is the difference between a clean GIF and one covered in banding and speckle.

Every decision below turns two dials: how many pixels per second you keep and how the 256 colors are chosen.

Six-step pipeline from video to GIF: pick clip, trim, scale, frame rate, palette, export, with the matching ffmpeg option under each step The six steps in order, with the ffmpeg option that handles each one.

Step 1: Choose the Clip

The best GIFs are short and loop cleanly.

Length. Aim for 2 to 6 seconds. A reaction or a UI interaction rarely needs more. If you need 20 seconds to make the point, you want a video, not a GIF.

Start and end on similar frames. A loop that jumps from a wide shot back to a close-up looks like a glitch. Find a moment where the motion returns near its starting position, or use a "boomerang" style (forward then reverse) so the loop has no seam.

Keep the camera still. Camera shake and pans change every pixel on every frame, which balloons file size. A locked-off shot where only the subject moves compresses far better, because GIF frames can store just the changed region.

Avoid gradients and grain. Skies, soft shadows, and low-light noise are the hardest things to squeeze into 256 colors. Screen recordings with flat UI colors convert beautifully.

Step 2: Set Frame Rate and Size

These two settings control most of your file size.

Use caseWidthFrame rateTypical length

Chat reaction

320 to 480 px

10 to 12 fps

2 to 4 s

Product or UI demo

640 to 800 px

12 to 15 fps

4 to 8 s

Email header

600 px (match the email width)

8 to 12 fps

2 to 4 s

Slide or doc illustration

480 to 960 px

12 to 15 fps

3 to 6 s

Custom chat emoji

128 px square

as low as it looks fine

1 to 2 s

Frame rate. 10 to 15 fps reads as smooth motion for most content. Going from 30 fps to 15 fps roughly halves the frame count.

Width. File size scales with pixel area, so halving the width cuts the pixels per frame to about a quarter. Always set width and let height follow the aspect ratio. Never upscale. Use a good scaling filter (Lanczos is a common choice) so text and edges stay crisp.

A useful habit: export once at your best guess, check the size, then adjust only one dial at a time. Trim length first, then frame rate, and shrink width last, because small GIFs with text become unreadable.

Bar chart of GIF file size for one 5-second clip at 320, 480 and 640 px wide and 10, 15 and 24 fps, from 0.42 MB to 2.88 MB Measured with ffmpeg 8.0.1 on a 5-second test clip: 640 px at 24 fps is 6.9x the size of 320 px at 10 fps.

Step 3: Get the Palette Right

This is where most bad GIFs come from, and it is the step most tutorials skip.

Per-clip palette. A good converter analyzes your actual footage and builds a 256-color palette tailored to it. A generic fixed palette wastes slots on colors your clip never uses.

Dithering. When a color is not in the palette, the converter can either snap to the nearest color (hard bands) or mix nearby palette colors in a pattern so your eye blends them (dithering). Dithering looks smoother but adds visual noise, and that noise compresses worse, so dithered GIFs are often larger. Two common styles:

  • Error diffusion (Floyd-Steinberg, Sierra): smoothest gradients, but the pattern shifts from frame to frame, which can shimmer and costs the most bytes.
  • Ordered / Bayer: a fixed, regular pattern. It is stable between frames, so it compresses better and does not crawl. A good default for animation.
  • None: smallest files. Works well for flat graphics, logos, and UI recordings.

Transparency. GIF supports one fully transparent color, with no partial transparency. Soft edges against a transparent background end up with a jagged halo, so give the GIF a solid background that matches where it will be shown.

Step 4: Pick a Method

Online GIF converters

Search "video to GIF" or "GIF maker" and you will find many browser-based converters. The workflow is the same everywhere: upload the video, trim start and end, set size and frame rate, convert, download.

Look for a GIF converter with precise trimming, separate width and frame rate controls, and a color-reduction or "optimize" step. Online tools are the fastest option for a one-off clip. Because the video leaves your machine, use a local method for unreleased features or anything with customer data on screen.

iPhone: Live Photo loops and Shortcuts

Live Photo effects. Apple's Photos app can turn a Live Photo into a Loop (plays continuously) or Bounce (plays forward and backward). Open the Live Photo, swipe up, and choose the effect. Apple also offers Long Exposure, which produces a still image instead. A Loop or Bounce is great for sharing a moving moment, but be aware the result is a looping clip inside Photos, and how it arrives depends on the app you share it to. If you specifically need a .gif file, use the next method.

Shortcuts. The Shortcuts app includes a Make GIF action, and the Gallery has a ready-made "Video to GIF" shortcut that lets you pick a video and trim it. Some versions of that shortcut show the GIF without saving it, so if nothing appears in your library, add a "Save to Photo Album" action at the end of the shortcut. Menu labels shift between iOS versions, so search for "GIF" in the action list if you do not see it where you expect.

ffmpeg (free, local, and the most control)

ffmpeg is a free command-line tool that runs on Windows, macOS, and Linux. It is the most reliable way to make a high-quality GIF from a video, because it can generate a custom palette for your exact clip.

The command below was tested on ffmpeg 8.0. It takes 3 seconds starting at the 1-second mark, converts to 12 fps at 480 px wide, builds a palette from that footage, and loops forever:

ffmpeg -ss 1 -t 3 -i input.mp4 \
  -vf "fps=12,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
  -loop 0 output.gif

What each part does:

  • -ss 1 -t 3: start at 1 second, keep 3 seconds. Change these to trim.
  • fps=12: output frame rate.
  • scale=480:-1:flags=lanczos: 480 px wide, height follows the aspect ratio, sharp scaling.
  • split[s0][s1]: makes two copies of the stream.
  • palettegen: analyzes one copy and builds the best 256-color palette.
  • paletteuse: maps the other copy onto that palette.
  • -loop 0: loop forever. Use -loop -1 for play once.

Tuning for smaller files. For footage where only part of the frame moves (a screen recording, a talking head), these options help:

ffmpeg -ss 1 -t 3 -i input.mp4 \
  -vf "fps=12,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" \
  -loop 0 output.gif
  • stats_mode=diff builds the palette from what changes between frames, giving more colors to the moving subject.
  • dither=bayer:bayer_scale=5 uses ordered dithering with a lighter pattern (the scale runs from 0 to 5; higher is subtler).
  • diff_mode=rectangle only re-processes the changed area of each frame.
  • palettegen=max_colors=128 (or 64) cuts the palette further for flat graphics.
  • paletteuse=dither=none turns dithering off entirely, often the smallest result for UI recordings.

Without the palette step, ffmpeg falls back to a generic palette, which produces muddy, banded GIFs.

Side-by-side zoomed frames: source video, GIF with ffmpeg's default palette showing a dot pattern, and GIF with palettegen matching the source Same frame at 480 px: the default palette dots the gradient, palettegen stays close to the source (on this clip it cost about 17% more bytes, 1,147 KB vs 977 KB).

When Not to Use a GIF

A GIF is the most compatible animated format, and also the least efficient. In many places, a short MP4 is smaller and looks better.

Bar chart comparing file sizes of the same clip as palette GIF, default GIF, animated WebP and muted MP4 at 320, 480 and 640 px Same 5-second clip at 15 fps and 480 px: 1,147 KB as a GIF, 230 KB as animated WebP, 85 KB as a muted MP4.

Use a muted MP4 when the platform plays video inline: most chat apps, social feeds, documentation sites, and code hosting comments. Here is a tested ffmpeg command for a small, widely compatible MP4 with no audio:

ffmpeg -ss 1 -t 3 -i input.mp4 -vf "scale=480:-2" -c:v libx264 -pix_fmt yuv420p -an -movflags +faststart output.mp4

The -2 keeps the height an even number (required by H.264), -an drops audio, and +faststart lets it start playing before the download finishes.

Use animated WebP when your destination is a modern browser or website that you control and you want GIF-like autoplay at a smaller size. Check support in every place the file will be shown before switching, because some editors and email clients still reject it.

Stick with GIF when you need it to animate in an image slot: email bodies, slide decks, README files, some chat emoji, and anywhere that accepts "images" but not "videos".

Platform Size Limits Worth Knowing

These are the documented numbers as of October 2026. Limits change, so check again if a file is near the line.

PlatformLimitSource

GitHub (issues, PRs, comments)

10 MB for images and GIFs; videos 10 MB on free plans, up to 100 MB on paid

GitHub Docs

Discord (free account)

20 MB per file (raised from 10 MB in August 2026)

Discord Help Center

Slack custom emoji

Slack recommends square images under 128 KB; GIFs can include up to 50 frames

Slack Help Center

For a Slack emoji, that means a 128 px square, very few frames, and probably no dithering.

Using GIFs in Slides and Emails

In slides. Insert the GIF as an image file saved to your computer, rather than copying and pasting from a browser, which can sometimes drop the animation. Most presentation apps show GIFs as still images while you edit and animate them only when presenting, so always test in present or slideshow mode. Keep slide GIFs short and looping, and avoid putting fast motion behind text the audience needs to read. If you need pause and play controls, insert a video instead.

In emails. Make the first frame meaningful on its own. Microsoft's own support documentation notes that Outlook can be set (by the user or the system's animation setting) to show only the first frame of an animated GIF. Put the key message or call to action in that first frame, keep the width at or below your email's content width (often around 600 px), and keep the file small so it loads quickly on mobile connections. Always include alt text.

FAQ

How do I convert MP4 to GIF without losing quality?

Some loss is unavoidable because a GIF frame holds at most 256 colors. You keep the most quality by building a custom palette from your clip (ffmpeg's palettegen and paletteuse filters do this), using a sharp scaling filter, and choosing a dithering style that suits the footage. Flat screen recordings can look almost identical to the source.

What is a good GIF file size?

It depends on the destination. For a chat reaction or email, aim for well under 1 to 2 MB so it loads instantly. For documentation, a few MB is acceptable. For a Slack custom emoji, Slack recommends staying under 128 KB. If you cannot hit your target without ruining the GIF, a muted MP4 is the better choice.

What frame rate should a GIF be?

10 to 15 fps covers most content. Fast action may need up to 20 fps, and slow screen recordings can drop to 8 fps. Each step down cuts the number of frames, which is the most direct way to reduce GIF file size without making it smaller on screen.

Can I make a GIF from a video on my iPhone?

Yes. The Shortcuts app has a Make GIF action and a ready-made Video to GIF shortcut in its Gallery. For Live Photos, the Photos app can apply Loop or Bounce effects by swiping up on the photo. If the shortcut does not save the result, add a Save to Photo Album action at the end.

Why does my GIF look grainy?

That grain is dithering, the converter mixing palette colors to fake the ones it does not have. Switch to ordered (Bayer) dithering for a calmer pattern, turn dithering off for flat graphics, or give the clip fewer colors to represent by avoiding gradients and low-light noise.

Create your next presentation with ChatSlide

Turn PDFs, research papers, medical documents, and raw data into polished slides in minutes.

Try it now