← All tools

Compress Video

Aim at a size β€” 10 MB for Discord, 25 MB for email β€” or just turn the quality down. Runs on your machine, so there is no size limit and no queue.

Size is arithmetic, not a slider

A video file weighs its bitrate times its length. So "make this fit in 10 MB" has an exact answer the moment you know how long the video is β€” there is no reason to make someone drag a quality slider, encode, check, and try again.

Encoders do not hit a requested bitrate precisely; rate control drifts depending on what is in the frame, and a noisy handheld shot overshoots where a locked-off one comes in under. Rather than pad the target with a safety margin and always deliver something needlessly small, the first result is measured and β€” if it missed β€” a second pass runs with the correction applied.

Why this can run in a tab at all

Compressing video used to require a server, because browsers could not encode. They can now: WebCodecs exposes the same hardware encoder your phone uses to record, and a laptop gets through 1080p faster than it could have uploaded it.

That changes the economics, not just the privacy. A service compressing on a server pays for every gigabyte it touches, which is why they cap file sizes, queue free users and watermark the output. None of those limits are here, because none of that cost is.

To shorten a video rather than shrink it, use the trimmer; to change format, the converter.

Your file is read and re-encoded by your own browser. No request carries it anywhere β€” this page has no upload endpoint to send it to.

Questions

Can it hit an exact file size?

That is what the "fit a size" mode does. A file's size is its bitrate multiplied by its length, so once the length is known the required bitrate is arithmetic. Encoders do not obey a requested bitrate perfectly β€” rate control drifts with the material β€” so if the first pass misses by more than a few percent, it measures the miss and re-encodes once with a corrected figure. In practice it lands within a couple of percent of the target.

Why 10 MB, 16 MB, 25 MB?

They are the walls people actually hit: 10 MB is the free Discord upload limit, 16 MB is WhatsApp, 25 MB is Gmail and most mail servers, and 50 MB is Discord Nitro Basic. The tool aims just under the limit rather than exactly at it, because a file that is 10.0 MB is still rejected by a 10 MB limit.

What if the target is impossible?

It says so before starting, and tells you the smallest honest size for that video. Squeezing an hour of footage into 10 MB would mean a bitrate no resolution survives β€” a tool that produced an unwatchable file and called it success would be worse than one that refuses.

How much smaller will my file get?

The estimate is shown before you press anything, from the settings and the length. Footage straight from a phone or camera is usually recorded far above what it needs, and 60–90% reductions are routine. Something already compressed once has little left to give, and the tool compares your file against what its resolution reasonably needs and warns you when re-encoding would only make it bigger.

What actually makes a video smaller?

Fewer pixels and fewer bits per pixel. Resolution is the blunt, reliable lever β€” 4K to 1080p removes three quarters of the pixels before quality enters into it. Bitrate then decides how much detail survives in what remains. Dropping audio helps a little; it is rarely more than a few percent of a video file.

Is it uploaded anywhere?

No. It runs through WebCodecs in your browser, which is what makes this practical: uploading a gigabyte so a server can hand back 200 MB is slower than doing the work locally, and it puts your footage on someone else's disk in the process. No size limit, no queue, no watermark β€” because there is no server to impose them.

The other tools

Build this into your own project

Compressing video to a target file size β€” the same way this page does it, on the user's machine, with no server. Take the code, or hand the prompt to a coding agent.

// npm i mediabunny
import { Input, Output, Conversion, BlobSource, BufferTarget, Mp4OutputFormat, ALL_FORMATS } from 'mediabunny';

// Size is bitrate x duration, so a target size fixes the bitrate.
const OVERHEAD = 0.04;               // container headers and packaging
const AUDIO_BITRATE = 128_000;

export async function compressToSize(file, targetBytes, { width } = {}) {
  const input = new Input({ source: new BlobSource(file), formats: ALL_FORMATS });
  const duration = await input.computeDuration();

  // Aim under the wall: a file of exactly 10.00 MB is still refused by a 10 MB limit.
  const aim = targetBytes * 0.96;
  const videoBitrate = Math.max(
    90_000,
    Math.round((aim * 8 * (1 - OVERHEAD) - AUDIO_BITRATE * duration) / duration),
  );

  const output = new Output({ format: new Mp4OutputFormat(), target: new BufferTarget() });
  const conversion = await Conversion.init({
    input,
    output,
    video: {
      ...(width ? { width } : {}),
      bitrate: videoBitrate,
      hardwareAcceleration: 'prefer-hardware',  // 180 fps vs 34 on an M5 at 1080p
    },
    audio: { bitrate: AUDIO_BITRATE },
  });

  if (!conversion.isValid) throw new Error('Cannot convert this file');
  await conversion.execute();

  return new Blob([output.target.buffer], { type: 'video/mp4' });
}

// Encoders drift, so measure and correct once if the first pass missed.
const blob = await compressToSize(file, 10 * 1024 * 1024);
console.log(blob.size / 1048576, 'MB');

The engine is documented for agents, and every tool page is available as markdown by adding .md to its address.