🇬🇧EN

Compress to Exact Size

Compress a JPG, PNG or WebP down to a target file size — 100 KB, 500 KB, or any value.

✨ What do you want to try next?

You've finished this tool — here are a few you might find useful.

Explore 100+ free toolsPDF, Image, Text, Convert, Calculate and more — all free.View all tools →

About the Compress to Exact Size Tool

Most compressors give you a quality slider and leave you guessing what file size you'll end up with. This one works the other way round: you tell it the size you need — 100 KB, 500 KB, 2 MB, or any custom value — and it finds the quality setting that lands as close to that as it can. It's built for the everyday situations where a form, portal or email has a hard limit: an upload that rejects anything over 500 KB, a passport or visa site capping photos at 100 KB, a job application, or a website that wants images under a certain weight.

How it works — the search for the right quality

There's no way to ask a browser for an image of exactly N kilobytes in one go — JPEG/WebP quality is a dial, not a size. So the tool does a binary search on the quality value:

  • It re-encodes the image at a middle quality and measures the resulting file size.
  • If the file is too big, it lowers the quality; if it's comfortably under the target, it nudges the quality back up to keep as much detail as possible.
  • It repeats, halving the range each time, for up to about nine passes — quickly closing in on the highest quality that still fits under your target.

The result is the best-looking image that fits your size limit. The tool then shows you the actual size it achieved, so you always know exactly how close it got. Everything runs on a <canvas> in your browser with toBlob(); the image is never uploaded.

Assumptions and behaviour

  • You choose the output format — JPEG (smallest, no transparency) or WebP (usually smaller still, keeps transparency). JPEG is the default because it hits small targets most reliably.
  • The image keeps its original dimensions — only the compression quality is changed, not the width/height. To reach very small targets you may also need to resize (see the Limitations).
  • The tool aims for the highest quality at or under your target, then reports the size it reached. If the target is easily met, it won't needlessly degrade the image.
  • Nothing is uploaded, logged or stored.

Limitations — honest caveats

  • It may not hit the exact number. Compression is approximate, so you'll usually land a little under the target (e.g. asking for 100 KB might give 94 KB). The tool always shows the real result rather than pretending it hit the number exactly.
  • Some targets aren't reachable by quality alone. Asking for 5 KB from a large, detailed photo isn't possible without wrecking it — in that case the tool tells you plainly ("Couldn't reach 5 KB without heavy quality loss — closest: 18 KB") instead of returning a garbled image. To go smaller, resize the image first with the Resize Image tool, then compress.
  • PNG has a size floor. PNG is lossless, so it can't be squeezed like JPEG. This tool reaches your target by re-encoding to JPEG or WebP — so a PNG input will change format (you'll be told). If you specifically need a PNG under a size, expect a much higher floor.
  • It compresses one image at a time; for many at once, use the Bulk Image Compressor.

Privacy

The whole process runs in your browser with the Canvas API. Your image never leaves your device — nothing is uploaded or stored.

Frequently asked questions

Is this tool free?

Yes — 100% free, no sign-up, no limits, and it runs entirely in your browser.

How do I compress an image to exactly 100 KB?

Upload the image, pick the 100 KB preset (or type 100 in the custom box), and the tool tunes the quality to get as close as it can. It then shows the actual size — usually just under your target.

Will it hit the exact size I ask for?

Almost never to the byte — image compression is approximate. You'll normally land slightly under the target, and the tool shows you the real figure so there's no guesswork.

What if it can't reach my target size?

It tells you honestly, e.g. "Couldn't reach 20 KB without heavy quality loss — closest: 41 KB," and gives you that closest result rather than a ruined image. Resizing the image smaller first lets you reach lower targets.

Why does my PNG come out as a JPG?

PNG is lossless and can't be compressed to small sizes, so the tool re-encodes to JPEG or WebP to reach your target. It flags the format change. Choose WebP if you need transparency preserved.

JPEG or WebP — which should I pick?

WebP usually produces a smaller file at the same quality and keeps transparency, but JPEG has the widest compatibility. If a site rejects WebP, use JPEG.

Does the image get uploaded anywhere?

No. Compression happens locally on your device with the Canvas API; the image is never sent or stored.

Lakshay Kumar

Written by Lakshay Kumar(TechLakshay)

A QA Automation Engineer by trade, Lakshay's real passion is untangling complex problems into simple, working solutions — which is exactly why FreeMyTask exists. On Instagram, he channels that same instinct into helping 26,000+ content creators with SEO education, motivation, and hands-on query solving.

Last updated: August 22, 2026
🎁