Skip to content

Compress Video to 25 MB for Gmail and Outlook

Choose or drop a video. You download a video that fits in a 25 MB email: an MP4 file, or WebM in a browser that cannot encode MP4. Email makes a file about 37% larger, so the file is at most 18.2 MB. The browser encodes the video, so no file is uploaded.

Full page version: joellof.com/compress-video/app/?limit=25mb

25 MB is the attachment limit of Gmail (a personal account) and of Outlook.com. Email sends a file as text in Base64, and that makes it about 37% larger. The headers and the text of the email add a little more. So a file just under 25 MB does not fit in a 25 MB email.

This page counts that. The video file can be up to 18.2 MB, and the email with it stays under 25 MB. A work or school account can have another limit: type it on the any size page and turn on For email.

The limits change, so check the help page of the service. Other limits:

  • Any size: type your own limit.
  • 8 MB: the old free limit of Discord, before 2023.
  • 10 MB: the free limit of Discord from 2024 to August 2026.
  • 20 MB: Discord.
  • 50 MB: Discord Nitro Basic.
  • It fits the email. The page picks the bit rate and the resolution from the length of the video, so the file is at most 18.2 MB, and the email under 25 MB.
  • A long video. When the whole video cannot look good in 25 MB, the page says how many seconds fit and compresses the start of the video.
  • Any video that the browser reads: MP4, MOV, WebM and more. The download is <name>-25mb.mp4, or <name>-25mb.webm in a browser that cannot encode MP4.
  • Keep the audio, or turn it off to give all the bits to the picture.
  1. Mediabunny reads the video and its duration, size and audio in the browser.

  2. The page computes the bit rates that fit the limit. It keeps 5% for the container, gives the audio 128 kbit/s (64 kbit/s for a long video) and gives the rest to the video. It picks the largest resolution that the video bit rate can carry: 1080p, 720p, 480p or 360p, and never a larger one than the input.

  3. The page encodes with the first encoder that the browser has:

    • H.264 and AAC in MP4 with WebCodecs, on the GPU when the browser can. Mediabunny writes the MP4 file.
    • VP9 and Opus in WebM with WebCodecs, when the browser cannot encode H.264. Mediabunny writes the WebM file. Discord plays WebM.
    • H.264 and AAC in MP4 with FFmpeg (libx264, in WebAssembly), when the browser has neither. The page loads FFmpeg (about 32 MB) only then. One pass, with the bit rate capped, so the file lands near the target.

    When an encoder fails during the encode, the page says so and tries the next one. Only the last one shows its error.

  4. When the file is still over the limit, the page encodes again at a lower bit rate. When that bit rate is too low for the picture, it goes one step smaller: mono audio at 32 kbit/s, then 240p, then 15 frames per second. When even the smallest step is over the limit, the page says how many seconds fit. A long video starts at the step that fits, so the page trims a video only when even the smallest step is too large. A step never raises the frame rate of the video.

Every current browser works. Chrome, Edge and Safari encode H.264 on the GPU: a short clip takes seconds. A browser that cannot encode H.264 gets a WebM file. A browser with no video encoder of its own uses FFmpeg, which runs on one thread and can be many times slower than the video is long, so the page shows the time left. FFmpeg keeps the whole video in memory, so it takes videos up to 500 MB.

Language TypeScript
UI React
Platform Browser (WebCodecs, WebAssembly)
Key Deps Mediabunny (MPL 2.0), ffmpeg.wasm
Build Bun

Mediabunny reads and writes the media files. It is under the Mozilla Public License 2.0. ffmpeg.wasm (@ffmpeg/ffmpeg, @ffmpeg/core) encodes in a browser with no WebCodecs encoder. This server serves the FFmpeg core, so no CDN gets your files.

The FFmpeg core is @ffmpeg/core 0.12.10 of ffmpeg.wasm, under the GPL 2.0 or later. Its source is in the ffmpeg.wasm repository.

  • View Metadata: see the codec, the resolution and the bit rate of a video before and after.
  • Convert to WAV: take the audio of a video as a WAV file.