Blog Upload Shorten Tools Gallery FAQ Contact Sign in
📢 永久無廣告,自動清除EXIF,保護隱私內容
Tools

🎯 Compress to Size

Say 2MB and it lands under 2MB

Enter the limit you must stay under — 2 for a 2MB form limit. The result is guaranteed to come in below it.
The tool will not push quality below this. Under 40% the loss is usually visible.
Recommended. Some images exceed the target even at minimum quality, and resizing is the only way down. With it off, the tool gets as close as it can and tells you how far off it is.

ℹ️ It works by binary search — repeatedly encoding at different quality levels to get as close as possible without going over. It usually converges within 8 attempts.

🔒 Everything runs inside your browser — your files are never uploaded to our servers and we never see them. Close the tab and nothing is left behind.

Compress to Size: before and after example
Original on the left, the actual output of this tool on the right — not a mock-up. Any file sizes or dimensions shown are real measured values.

Step-by-step

  1. Choose your images Drag them in or click to select — several at once is fine. Each image gets its own quality level worked out; they do not all share one setting.
  2. Enter the target size Type the number you have to stay under. A form saying "2MB max" means 2 with MB selected; "under 500KB" means 500 with KB. The result is guaranteed to come in below it, not right on the line.
  3. Pick the output format Use JPG if you are not sure — it has the best compatibility. If the receiving system accepts WebP, it holds noticeably more quality at the same target size.
  4. Decide about resizing Leave it on. Some images exceed the target even at the quality floor, and shrinking dimensions is the only way down. With it off, the tool gets as close as it can and tells you how far off it landed.
  5. Run it and download You are told what quality it settled on and whether it had to resize. The filename carries the target, e.g. photo-2048kb.jpg.

When you would use this

Upload limits on forms and government portals

This is why the tool exists. The form says "2MB maximum" and your photo is 6MB — with an ordinary compressor you drag the slider and re-check several times. Here you type 2 and you are done.

Email attachment caps

Gmail allows 25MB per message and plenty of corporate mailboxes stop at 10MB. Sending ten photos? Put each under 800KB and it goes through. Select all ten and each is compressed to fit individually.

Marketplace image requirements

Amazon, eBay, and regional marketplaces all cap product image sizes. Batch everything under the platform limit and nothing gets rejected during listing.

Keeping a page within a performance budget

Want your hero image capped at 200KB? Enter 200 and pick KB. Setting an explicit budget is far easier to hold a whole site to than eyeballing a quality slider. Pair it with Resize Image to cut the width first.

Why this needs its own tool

A normal compressor works one way: you give it a quality level, it gives you a file size. Real requirements usually run in the opposite direction — the form says "2MB maximum", the corporate mailbox rejects anything over 10MB, the marketplace caps product images at 500KB. What you want is not "80% quality", it is "under this number, and as good as possible".

Doing that by hand means dragging a slider, checking the size, still too big, dragging again — three or four attempts per image, forty for ten images. This tool automates the loop, and searches per image, so one unusually large photo does not drag the quality of the whole batch down.

What it actually does

The core is a binary search. With a quality floor of 40% and a ceiling of 95%, the first attempt encodes at 67.5%:

  • Under the target → there is headroom, search upward (and remember this passing result)
  • Over the target → too ambitious, search downward

Each round halves the range, so 8 rounds narrow 55 percentage points to under 0.2. It also stops early once a result reaches 93% of the ceiling — squeezing closer than that buys the user nothing and only costs more encoding time.

When even minimum quality is too big

This happens more often than you would think. A 4000×3000 photo compressed to 200KB is fighting its own pixel count: no reasonable quality level will get it there. The only remaining lever is dimensions.

With "allow resizing" on, the tool shrinks to 0.8× (about 64% of the area) once quality bottoms out and searches again, up to 6 times. In practice one or two rounds usually clear it — and the quality you buy by resizing generally looks far better than the quality you lose by over-compressing. A sharp 2000px photo beats a 4000px one riddled with artefacts every time.

JPG or WebP

If the receiving system takes WebP, choose it. At the same target size WebP retains noticeably more detail, which means the search can stop at a higher quality level. Just confirm it is accepted first — a great many upload fields still recognise only .jpg and .png.


Frequently asked questions

Why is the result not exactly the size I asked for?
Because the number is a ceiling, not a target. The tool finds the highest quality that still fits, so results usually land between 85% and 99% of the limit. Asking for 2MB and getting 1.9MB is correct — landing exactly on 2.00MB would risk being judged over by systems that count bytes differently.
How does it know how much to compress?
By binary search. It encodes once at the midpoint between your quality floor and 95%, goes lower if the file is too big and higher if there is room, for up to 8 rounds. Every round remembers the best passing result, so even without full convergence there is always something usable.
What if it cannot reach the target at all?
With "allow resizing" on, the tool starts shrinking dimensions (to 0.8× each time) once quality bottoms out and searches again, up to 6 times. If it still cannot get there — say, an 8000px image down to 10KB — it hands you the closest result and says plainly that it missed. It does not pretend to have succeeded.
How is this different from the regular compressor?
With Compress Image you pick the quality and it tells you the size. Here you pick the size and it finds the quality. Different jobs: the first is for "I want this to look good", this one is for "I must be under this number".

What you might need next

Image work rarely ends in one step. These pair up with Compress to Size most often:

Want to share the result? Upload turns images, photos, or videos into a short link with optional password, expiry, and view limits. Or head back to all 12 tools.


More tools