Compress an image to an exact file size

🔒 Your files never leave your device

Pick a limit — 100 KB, 500 KB, 2 MB — and get a file under it. No quality slider to guess at, no account, no upload.

or drag and drop it here

JPEG, PNG, WebP, GIF, BMP

How this hits the number exactly

Most compressors give you a quality slider from 1 to 100 and leave the arithmetic to you. That is a guessing game, because the relationship between JPEG quality and the resulting file size depends on the picture itself: a photo of a clear sky compresses far smaller at quality 80 than a photo of a crowd does. The HTML specification goes further and says outright that different browsers may interpret the same quality value differently, so there is no lookup table anyone could publish that would be correct everywhere.

This tool works the other way around. It encodes your image, measures the actual byte count, and adjusts — repeating a binary search about nine times until it finds the highest quality setting that still fits under your limit. You get the best-looking image that satisfies the constraint, rather than an arbitrary quality number that happens to land somewhere near it. The Encoding passes figure in the results tells you how many attempts it took.

If your target is so small that even heavy compression cannot reach it, the tool reduces the pixel dimensions in steps and searches again. You can turn that off with the checkbox if the dimensions matter more to you than the file size.

Why nothing is uploaded

Every step happens in your browser using the canvas API, on a background thread so the page stays responsive. Your image is never sent anywhere, which means there is no server-side copy to be retained, leaked, or quietly used for training. It also means the tool works offline once the page has loaded.

There is a useful side effect: because canvas encoding writes out pixels and nothing else, the EXIF metadata block does not survive the round trip. GPS coordinates, camera model, and the original timestamp are all gone from the file you download. If you are posting a photo publicly, that is usually exactly what you want — though it also means you should keep the original if you care about that data.

When you actually need this

Almost every hard file-size limit comes from an upload form that will not budge:

  • Job and exam applications — photo and document uploads capped at 100 KB or 200 KB are extremely common, and the form usually rejects the file without telling you how far over you are.
  • Government and bank portals — scanned ID and proof-of-address uploads, often with a 500 KB or 1 MB ceiling.
  • Email attachments — staying under a mailbox limit when sending several photos at once.
  • Website performance — getting a hero image under a size budget without dropping to a visibly bad quality setting.

Choosing a format

FormatBest forSize targeting
JPEGPhotographs, anything with gradientsPrecise — quality is adjustable, so almost any target is reachable
PNGScreenshots, line art, text, transparencyCoarse — PNG is lossless and ignores the quality setting, so the only lever is dimensions

If you choose PNG and the file still comes out too large, the tool can only shrink the image. For a photograph, JPEG will get you a far smaller file at the same visual quality. Note that transparent areas become white when converting to JPEG, since JPEG has no alpha channel.

Questions people ask

Will the image look bad?

That depends entirely on how aggressive your target is relative to the image. The tool never goes below a quality of 0.20, because past that point JPEG artefacts are worse than a missed target — if it cannot reach your number without crossing that line, it tells you so instead of returning mush.

Can I compress a HEIC photo from my iPhone?

On Safari 17 and later, yes — HEIC decodes natively. Chrome and Firefox cannot decode HEIC at all, so on those browsers you will need to convert to JPEG first.

Is there a file size limit?

Only your device's memory, plus one platform ceiling: browsers refuse canvases larger than roughly 8192 × 8192 pixels. Above that the tool scales the image down to fit automatically and tells you the new dimensions.

Does it work on a phone?

Yes. The whole tool is client-side and works the same on mobile Safari and Chrome.