🎯 Compress to Size
Say 2MB and it lands under 2MB
ℹ️ 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.
Step-by-step
- 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.
-
Enter the target size
Type the number you have to stay under. A form saying "2MB max" means
2with MB selected; "under 500KB" means500with KB. The result is guaranteed to come in below it, not right on the line. - 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.
- 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.
-
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?
How does it know how much to compress?
What if it cannot reach the target at all?
How is this different from the regular compressor?
What you might need next
Image work rarely ends in one step. These pair up with Compress to Size most often:
- 🗜️ Compress Image — Shrink file size while keeping quality
- 📐 Resize Image — By width, percentage, or exact size
- 🖼️ Convert to JPG — PNG, GIF, and WebP to JPG
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
Compress Image
Shrink file size while keeping quality
HEIC to JPG
iPhone photos into a format everything reads
View & Remove EXIF
See what your photo reveals, then strip it
ID Photo Sizes
Passport and ID sizes, print sheet included
Resize Image
By width, percentage, or exact size
Upscale Image
Enlarge up to 4× the original size
Crop Image
Drag to select the area to keep
Rotate Image
Batch rotate and flip
Add Watermark
Text watermark with position & opacity
Blur & Redact
Hide faces, plates, and personal data
Convert to JPG
PNG, GIF, and WebP to JPG
JPG to PNG
Convert to lossless PNG or WebP
PNG to WebP
Typically 30%+ smaller files
Split into Grid
Cut into a 3×3 Instagram grid
Merge Images
Join several images into one long strip
Favicon Generator
Every size plus a real .ico file
Extract Colours
Pull the key colours with HEX and CSS
SVG to PNG
Vector to raster at any size you want
Image to Base64
Data URI, CSS, and HTML snippets
Video Frame Grab
Grab any frame as a cover image
Video to GIF
Turn a clip into an animated GIF
Remove Background
For white and green-screen product shots
Image to Text (OCR)
Pull the text out of a screenshot
Images to PDF
Merge multiple images into one PDF
PDF to Images
Every page as a JPG or PNG