Blog
DevelopersSeptember 29, 2026 · 9 min read
By the ZoomCap teamPublished September 29, 2026Facts checked September 29, 2026

How to Add a Demo GIF to Your GitHub README

Record a demo, convert it to a GIF or MP4, keep it small, and embed it in your README, with dark and light versions. Commands, sizes and markdown included.

By the ZoomCap team.We make ZoomCap, which appears in this article. Prices and features were checked on each vendor's own site on September 29, 2026. Where we could not test a tool ourselves, we say so. How we test

Short answer

Record a 5–15 second clip of one feature, convert it to a GIF at about 800 px wide and 10–15 fps (ZoomCap's free converter does it in the browser with no upload; ffmpeg if you want full control), keep it under roughly 5–10 MB, commit it to your repo and embed it with <img src="docs/demo.gif" width="800">. If you don't need autoplay, drag an MP4 into the README editor on github.com instead: it renders as a video player and is smaller. For a GUI or web app, ZoomCap records the clip, zooms in on the action so it reads at README width, and exports the GIF or MP4 directly. For pure terminal tools, VHS or asciinema can generate the GIF from a script.

A demo GIF at the top of a README answers the first question every visitor has: what does this actually do? This guide covers how to add a demo GIF to a GitHub README from start to finish: recording a clip that reads well at README size, converting it to a GIF (or an MP4), keeping it small, and the markdown and HTML snippets to embed it, including a dark-mode version.

How to add a demo GIF to a GitHub README: the steps

  1. Pick one feature and plan a 5–15 second clip that shows it working.
  2. Record a small window with large text.
  3. Trim the pauses before and after.
  4. Convert to GIF at 640–800 px and 10–15 fps, or keep it as an MP4.
  5. Store it in the repo (for example docs/demo.gif) or upload it through GitHub's editor.
  6. Embed it with markdown or an <img> tag, and check the rendered README on desktop and phone.

GIF or MP4?

Both work on GitHub. GitHub renders uploaded .mp4 and .mov files as video players in READMEs, issues and pull requests when you add them through the web editor's drag-and-drop, which gives them a github.com/user-attachments/… URL. The difference is how they behave:

GIFMP4 / MOV (uploaded through GitHub)
PlaysAutomatically, inline, on loopWhen the visitor clicks play
Size for a 10 s clipTypically several MBTypically a fraction of the GIF
SoundNoYes
Quality256 colours per frame; gradients bandFull colour
Works outside GitHub (npm, PyPI, docs sites)Almost everywhere images workDepends on the site
Best forThe hero demo at the top of the READMELonger walkthroughs, anything with sound

Our usual pattern: a short GIF at the top, so the README shows motion the moment it opens, and a longer MP4 further down (or a link to one) for people who want the full tour.

1. Record a clip that reads at README size

The README column is well under 1,000 px wide on a desktop and much narrower on a phone, so recording choices matter more than conversion settings.

  • Record a small window, around 1000–1280 px wide, not a full Retina display. After scaling to 800 px, text stays legible.
  • Make text big. Bump the browser zoom to 125% or the terminal font to 16–20 pt.
  • Use a plain theme and background. Gradients and wallpaper waste the GIF's 256 colours.
  • Clean up the prompt and paths. A short prompt like $, a demo directory, no usernames or hostnames, and no tokens in the scrollback.
  • Move deliberately and pause a beat after each result so it can be read.
  • Show one feature. The first GIF is a hook, not documentation.

We record ours with ZoomCap (we make it): the free browser recorder works in Chrome or Edge on any OS, and npx zoomcap record on macOS or Linux X11 zooms in automatically where you click and type, which is what keeps a small UI legible at 800 px. If you only need a raw capture, any recorder works: Shift-Command-5 on a Mac, the Snipping Tool or OBS on Windows, OBS or your desktop's recorder on Linux. More on the options for Mac in how to record your screen on a Mac.

2. Trim it

Cut everything before the first meaningful action and after the result has been visible for a second or two. Trimming is the biggest size saving there is: a GIF's size grows roughly in line with its length. With ffmpeg, -ss and -t trim during conversion (next step), so you don't need a separate editor.

If the loop should restart cleanly, end on the same screen you started on.

3. Convert it

The quickest way: our free MP4 to GIF converter does the conversion in your browser tab (tested by us; we built it). It converts the first 30 seconds of an MP4, WebM or MOV at up to 720 px wide and 12 fps, with no upload, no sign-up and no watermark. It has no trim or crop controls, so trim first. If you recorded in ZoomCap, skip this step and export the GIF from the editor.

If you want full control over width, frame rate and palette, use ffmpeg with a generated palette. This takes 8 seconds starting 2 seconds in, at 12 fps and 800 px wide:

ffmpeg -ss 2 -t 8 -i demo.mp4 \
  -vf "fps=12,scale=800:-1:flags=lanczos,split[a][b];[a]palettegen=stats_mode=diff[p];[b][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" \
  -loop 0 docs/demo.gif

We explain every option, plus gifski for higher quality and gifsicle for shrinking, in how to turn a screen recording into a GIF.

If you keep it as an MP4, make it small and widely playable before uploading:

ffmpeg -i demo.mp4 -vf "scale=1280:-2" -c:v libx264 -crf 24 \
  -pix_fmt yuv420p -movflags +faststart -an demo-small.mp4

Drop -an if you want to keep the sound.

4. Decide where the file lives

OptionHowProsCons
In the repoCommit to docs/, assets/ or .github/, reference by relative pathVersioned with the code; works in forks and offline clonesEvery version stays in git history forever, so size adds up
GitHub uploadDrag the file into the README editor, an issue or a PR comment on github.com; copy the user-attachments URL it insertsNo repo bloat; the only way to get the inline video playerNot versioned with the code; tied to GitHub
External hostYour website or CDN, absolute URLSame file can be used on your docs siteGitHub proxies external images, and very large ones may load slowly or fail

If you re-record the GIF often, the upload route keeps your repository lean. If the README is also published to npm, PyPI or crates.io, relative image paths may not resolve on those sites; check the rendered page there and switch to an absolute URL if the image is broken.

5. Embed it: markdown and HTML snippets

Plain markdown

![Demo: creating a project in three commands](docs/demo.gif)

Simple, but the GIF displays at its own width (up to the column). Write alt text that says what the demo shows, not just “demo”.

HTML with a fixed width, centred

<p align="center">
  <img src="docs/demo.gif" width="800"
       alt="Creating a project in three commands">
</p>

GitHub allows a limited set of HTML in markdown, including <img> with width and the align attribute. Setting width lets you export a slightly wider GIF for sharpness on high-density screens while displaying it at column width.

Different GIFs for dark and light mode

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="docs/demo-dark.gif">
  <source media="(prefers-color-scheme: light)" srcset="docs/demo-light.gif">
  <img src="docs/demo-light.gif" width="800"
       alt="Creating a project in three commands">
</picture>

GitHub serves the file that matches the viewer's theme. This doubles the recording work, so it is worth it mainly when the GIF has a transparent-looking edge or a background that clashes with one of the themes. A simpler alternative: record on a neutral mid-tone background that sits acceptably on both.

[![Creating a project in three commands](docs/demo.gif)](https://example.com/full-demo)

An uploaded video

Drag the MP4 into the editor on github.com. GitHub inserts a URL on its own line, and the rendered README shows a player:

https://github.com/user-attachments/assets/<id>

Leave that URL on a line by itself; wrapping it in other markdown can turn the player back into a plain link. Preview before committing.

Size limits and targets

GitHub documents separate upload limits for images, GIFs and videos, and the video limit has differed between free and paid plans. We are not quoting numbers here because they change: check GitHub's current docs on attaching files before you rely on one. For files committed to the repository, GitHub's docs say it warns about files over 50 MB and blocks files over 100 MB in a normal push; a README GIF should never get close to either.

Our own targets, which keep the README quick to load:

  • Top-of-README GIF: under 5 MB; about 10 MB at most.
  • Secondary GIFs further down: 1–3 MB each, cropped tightly.
  • Uploaded MP4: small enough to start quickly on a phone; a 30–60 second 1080p clip at CRF 24 is usually a few MB.

If you are over, trim, crop, drop to 10 fps or 640 px, or run gifsicle -O3 --lossy=80 (details in the GIF conversion guide). Some viewers turn off autoplaying animated images in their GitHub accessibility settings, so make the first frame meaningful on its own.

Terminal tools: generate the GIF from a script

For command-line tools, you may not need a screen recording at all. Two free tools produce crisp, small GIFs of terminal sessions:

  • VHS (from Charm) reads a .tape script of commands and keystrokes and renders it to a GIF or MP4. Because it is scripted, you can regenerate the GIF in CI whenever the output changes.
  • asciinema records a real terminal session as text; its agg tool converts the recording to a GIF.
# demo.tape (VHS)
Output docs/demo.gif
Set FontSize 18
Set Width 1000
Set Height 560
Type "mytool init my-project"
Enter
Sleep 2s

We compare these with real video, including when each is the better choice, in how to record a terminal demo that doesn't suck.

Tools

What we used or checked for this guide. ffmpeg, gifsicle, our converter and ZoomCap were tested by us; the others are described from their project pages.

ToolPriceBest forMain tradeoff
ZoomCap editorFree plan (2 watermarked exports a month); $29 once (or $12.49/month)GUI apps and web apps, with zooms and a backgroundGIF fixed at 15 fps, up to 960 px; no palette controls
ZoomCap MP4 to GIFFreeQuick conversion in the browser, no uploadFixed 12 fps and 720 px; first 30 seconds; no trim
ffmpegFree, open sourceTrimming, cropping and converting with full controlCommand line only
gifski / gifsicleFree, open sourceHighest-quality GIFs / shrinking existing GIFsgifski files run larger; gifsicle's lossy mode adds noise
VHS, asciinema + aggFree, open sourceTerminal toolsTerminal only; no GUI

Where ZoomCap fits: if your project has a GUI or a web interface and a raw capture looks small in the README, ZoomCap's editor zooms in on the action and exports a GIF or MP4 with a background and padding. Record in the free browser recorder (Chrome or Edge, zooms placed by hand) or with npx zoomcap record on macOS or Linux X11 (paid), which zooms automatically from your clicks. It costs $29 once (or $12.49/month). It is not the right tool for pure terminal demos (VHS or asciinema are smaller and sharper there), it has no Windows CLI, and on Linux the CLI records X11 sessions only. Recordings are edited and encoded on your computer and never uploaded; see the security page for how that works.

Frequently asked questions

How do I add a GIF to a GitHub README?

Commit the GIF to your repository (for example docs/demo.gif) and reference it with markdown: ![Demo](docs/demo.gif). To control the size, use HTML instead: <img src="docs/demo.gif" width="800" alt="Demo">. You can also drag the GIF into the README editor on github.com, which uploads it and inserts the link for you.

Can I put a video in a GitHub README instead of a GIF?

Yes. Drag an MP4 or MOV file into the editor while editing the README (or an issue or pull request comment) on github.com. GitHub uploads it and inserts a link that renders as a video player. The video does not autoplay like a GIF, but it is usually much smaller and can have sound. Check GitHub's current documentation for the file size limit.

What size should a README GIF be?

Aim for under 5 MB and treat about 10 MB as the ceiling, at 640 to 800 pixels wide and 10 to 15 fps, for 5 to 15 seconds. Larger GIFs load slowly on the repository page and bloat your git history, because every committed version stays in the repo forever.

How do I show a different GIF in dark mode on GitHub?

Use a <picture> element with two <source> tags, one with media="(prefers-color-scheme: dark)" and one with media="(prefers-color-scheme: light)", plus a fallback <img>. GitHub picks the file that matches the viewer's theme.

Is it safe to convert my demo with an online GIF converter?

It depends on whether the converter uploads your file. Many do. ZoomCap's free MP4 to GIF tool converts inside your browser tab and never uploads the video, which matters if the demo shows an unreleased feature or private data. ffmpeg and gifski are local too.

Launching the project too? See how to make a Product Hunt launch video, and the ZoomCap docs for recording setup.

Make your README demo now. Record free in ZoomCap's browser recorder and export a GIF, convert an existing video with the free MP4 to GIF converter, or get unlimited watermark-free exports and automatic zoom for $29 once on the pricing page.

What ZoomCap costs

Checked September 29, 2026

Free

$0

Browser recorder and editor, 2 exports a month with a small watermark.

Lifetime

$29

One payment. Unlimited exports, no watermark, the CLI, 4K export.

Pro

$12.49/mo

Same features as Lifetime, cancel anytime.

Over three years, ZoomCap Lifetime costs $29 and Screen Studio's yearly plan costs $324 ($108 a year), a difference of $295. Of the 18 recorders we price-checked, ZoomCap is the only one at $29 one-time that records in the browser with nothing to install, zooms on both clicks and typing, and runs from the terminal on macOS and Linux. Start free, and pay once only if it earns it.

14-day refund window on paid plans · refund terms · pricing page

Is ZoomCap safe?

Your recordings
Recorded, edited and encoded on your own computer. Video never goes to our servers: the CLI hands the file to the editor over localhost. See the data flow
Keystrokes
Only the timing of key presses, to drive typing zoom. Which keys you pressed is never captured or stored.
Account and payments
Sign-in and licence records are held by Google Firebase. Payments are processed by Dodo Payments, so we never see your card. Privacy policy
Refunds and support
If ZoomCap doesn't work for you and we can't fix it, email us within 14 days for a refund. Commercial use is allowed on every plan. Contact us · About ZoomCap

What ZoomCap doesn't do

  • No Windows CLI yet. On Windows, use the free browser recorder in Chrome or Edge.
  • No motion blur.
  • Speed changes apply to the whole video (1×, 1.5× or 2×), not per section.
  • Automatic zoom needs the CLI's click data. On browser recordings and imported videos you place zooms by hand.
  • On Linux the CLI records video only (X11 sessions, no Wayland, no system audio yet).
  • No hosted share links, comments or viewer analytics. You export a file and share it yourself.