Compress Image to Size
Pick one image, type the size limit your form prints, and the quality is tuned to fit under it — or the page tells you it couldn't. Pixel dimensions never change, and everything runs in your browser.
How to use
- Choose one image: Drop a JPG, PNG, WebP or AVIF file onto the box or click to pick it. One image per run, up to 50 MB, and it stays on your device.
- Type your target size: Put the number your form asks for into Target size and set the unit to KB or MB. It starts at 100 KB. Under Common targets you can tap 50 KB, 100 KB, 200 KB, 500 KB, 1 MB or 2 MB instead of typing.
- Compress and check the size: Click Compress to target size. The line above the preview tells you the size before and after and whether the result is inside your limit.
- Download the result: Check the result line first, then save the file — a re-encoded result is named after the target, like photo-100kb.jpg, while a returned original keeps its own name. If the line says the target wasn't met, lowering the target won't help: reduce the pixel size in another tool, or convert the image to JPG or WebP, and compress that copy. If the result did fit but the portal still rejects it for size, run it again with a slightly smaller target, since some forms count bytes differently or re-process what you send.
Compress image to size: how it works
Compress Image to Size processes one image up to 50 MB locally in your browser, aiming for a target such as 100 KB or 2 MB without resizing its pixels. If the target cannot be reached, you can download the smallest encoded result or the original, with a warning that it remains over the limit.
Choose a file, type a number in Target size, set the unit to KB or MB, click Compress to target size, and download the result. It is built for forms with a hard ceiling — a job portal that rejects anything over 2 MB, an exam application that wants a 50 KB photo, a visa form that caps a scan at 500 KB.
Hitting a number means searching for a quality. The tool encodes the picture at a quality somewhere between 5 and 95, measures how many bytes came out, narrows the range and tries again — up to eight times — then hands you the largest result that still fits. Largest rather than smallest is deliberate: the file closest to your limit is the one that kept the most detail. Eight attempts are a close approximation rather than an exhaustive search, so a result that fits lands a little below your target instead of exactly on it.
Whether anything fits at all depends on the format and the picture. When even the lowest quality is still over your number, the search has nothing that qualifies: you get the smallest file it managed to produce and a line telling you the target was not met, rather than a result dressed up as a success. The section below has the measured cases.
Nothing is uploaded. The compression engine is libvips compiled to WebAssembly (wasm-vips), downloaded with the page and run by your own browser, so no image bytes leave the device and closing the tab leaves nothing behind. This page also carries no ads and no analytics: that engine needs a cross-origin-isolated page to run, and we switch both off on the isolated pages.
The limits are one image per run, 50 MB per file and about 100 megapixels (roughly 10000 × 10000). Any target above zero is accepted and there is no upper bound — asking for 10 MB on a 500 KB photo is allowed, and if re-encoding would make the file bigger than the one you brought, your original comes back instead. Sizes here are counted in binary units: 1 KB = 1024 bytes, 1 MB = 1024 KB, which is how every size on the page is displayed.
What to type in Target size, and how close the result gets
Measured with Node 24.22 and wasm-vips 0.0.18: photo.jpg, 541,541 B, 1200 × 800. Browser results were not checked at every target. target 50 KB → 49,627 B (48.5 KB, 3% under) target 100 KB → 100,623 B (98.3 KB, 2% under) target 200 KB → 204,088 B (199.3 KB, 0.4% under) target 500 KB → 458,201 B (447.5 KB, 10% under) target 1 MB → original handed back (529 KB, already inside) target 2 MB → original handed back (529 KB, already inside)
Use the exact number the form prints, not a round guess. The common limits are in the Common targets row — 50 KB, 100 KB, 200 KB, 500 KB, 1 MB and 2 MB — and tapping one fills in the box and switches the unit for you. Anything else you can type, in KB or MB.
On the 529 KB camera JPEG in the table above, every one of those targets came back inside the limit, and usually with little room to spare: 98.3 KB against a 100 KB target, 199.3 KB against 200 KB. How much headroom is left depends on where the eight quality steps happen to land, so the same file given a 500 KB target came out at 447.5 KB — 10% under — simply because the next quality up would have gone over.
Those percentages belong to that one file. Another image can land anywhere between a hair under your number and well below it, or miss it entirely, because the bytes a quality step costs depend on the format and on how much fine detail and noise the picture carries. Those byte counts also come from a Node run of the same engine rather than from a browser session at every target, so read the table as one measured sample and read the result line on the page for the file you actually brought.
When you get a re-encoded file, the download is named after the target you asked for, so photo.jpg compressed to 100 KB arrives as photo-100kb.jpg — handy for keeping one version per form. The target suffix is only added to that file. Give the same photo.jpg a 1 MB target and, as the table above shows, your original comes back instead, under its own name: photo.jpg, unchanged.
If a portal is strict, leave yourself a margin. Some forms measure the file after their own processing, and a result at 99.6% of the ceiling has nowhere to go. Try a slightly smaller target, such as 1.8 MB for a 2 MB limit, then inspect the preview and check the portal's other requirements.
When the target can't be reached
Every format has a floor, and below it the tool says so instead of pretending. Quality 5 is the lowest setting it will write, so the smallest the test photo above could become was 48.5 KB. Targets of 20 KB and 5 KB produced that same 48.5 KB file, over the limit, and the page reported the size it actually reached and suggested a smaller pixel size or converting to JPG or WebP. You still get the file — it is simply the smallest version this tool can make, not a result that meets your number.
A PNG barely moves here, which matters because screenshots and exported graphics are usually PNGs. PNG compression is lossless, and this build has no palette quantizer, so the quality setting the search is turning has nothing to act on: our 209.6 KB test PNG came out at 177.5 KB — about 15% smaller — at 5 KB, 20 KB, 50 KB and 100 KB targets alike — all four runs byte-identical. The page warns you about this as soon as you pick a PNG. To get a PNG under a small limit, export it as a JPG or WebP in an image editor on your own device — Preview on a Mac, the Photos app or Paint on Windows, the photo app on a phone — and bring that copy back here.
You will never be handed a file larger than the one you brought. A small or already heavily squeezed image can come out bigger when it is re-encoded, and in that case the original bytes are what you download, under the original name. Our 2.3 KB test photo did exactly that: every target from 5 KB to 2 MB produced a 2,972-byte result, so the 2,322-byte original was returned each time. The page then says one of two things — that your original was kept and already meets the target, or that it was kept but is still over it, which is what happens when you ask a 2.3 KB file for 1 KB.
What the result keeps: pixel size, format, and the GPS location
The pixel dimensions never change. Many tools in this category are titled "resize to KB" and quietly shrink the picture to hit the number; this one only re-encodes, so a 1200 × 800 photo compressed to 100 KB comes back 1200 × 800. That is the right behavior for the forms people use it on, because an exam or visa upload that caps the file size often mandates the pixel size in the same sentence, and a silent downscale gets the submission rejected. The flip side is that when a target is out of reach, shrinking the picture is a step you have to take yourself.
JPEG, PNG, WebP and AVIF keep their format. The output follows the file you put in and there is no format option on this page, so a JPEG comes back as a JPEG, a PNG as a PNG, a WebP as a WebP and an AVIF as an AVIF.
Other containers may become JPEG when the encoded result is used. A container the tool can't identify from its header — GIF, TIFF, SVG — is written out as a JPG, and animation is dropped with it, so a GIF or an animated WebP becomes its first frame alone. Both of those apply only to the re-encoded file.
Returning the original preserves its format and animation. When the re-encode came out larger and your original was handed back, those are the original bytes: a TIFF is still a TIFF and an animated GIF still animates. That outcome is a real possibility for exactly these containers, because a GIF or TIFF written out as a JPG can easily end up bigger than the file you brought.
The compressed copy keeps the photo's metadata, including where it was taken. This tool does not touch the EXIF block, so the capture time, camera make and model, exposure settings, lens, orientation, XMP and the color profile travel into the result, and so do the GPS coordinates. We measured it: a test photo compressed to a 50 KB target still reported a latitude of about 3.1083 and a model of iPhone 15 Pro. The page says so above the download, because on a public listing or profile that location is worth more to a stranger than to you.
There is no switch here to remove it. If the image is going somewhere public, clear the location on your own device before you compress: on Windows, right-click the file and use Properties → Details → Remove Properties and Personal Information; on an iPhone, open the share sheet, tap Options and turn Location off. Then bring that copy here, where the only thing that matters is the number on the form.
What this page doesn't do
This page answers one question: how do I get this file under X KB? You name the limit and the tool works out the quality, which beats guessing a slider value and re-reading the file size afterwards. What it won't do is let you choose the quality yourself, pick an output format, or drop the location data — for those, use an image editor on your device, and converting a stubborn file to JPG or WebP there before setting a target here is a normal way to get under a small limit.
There is no batch mode — one image per run, so a folder goes through one at a time. Nothing here can make a picture sharper or bigger, since compression only discards information. HEIC photos straight off an iPhone can't be opened at all, because decoding them needs a library this build does not include; share or export the photo as a JPG first, which an iPhone normally does for you when you attach it to an email. And a PDF that is over a size limit is a different tool: use Compress PDF for that.
Frequently asked questions
- How do I compress an image to 100 KB?
- Choose the image, leave Target size on 100 with the unit on KB — or tap 100 KB under Common targets — and click Compress to target size. The tool searches for the highest quality that still fits. On our 529 KB test JPEG the result was 98.3 KB, and it downloads as photo-100kb.jpg.
- Why is the result under my target instead of exactly on it?
- Because the search aims to fit under your number rather than to land on it. The tool tries up to eight quality settings and keeps the biggest file that still fits, so it stops just below. On our test photo a 200 KB target gave 199.3 KB and a 500 KB target gave 447.5 KB, where the next quality step would have gone over. If nothing fits — the format can't get that small — you get the smallest result it reached, over your number, and the page says the target wasn't met.
- Does this change my image dimensions or crop it?
- No. The pixel size is untouched — a 1200 × 800 photo compressed to 100 KB is still 1200 × 800. Only the encoding quality changes. That matters for exam, visa and job forms that set a pixel size as well as a file size, since a tool that resizes to hit the number can get your upload rejected.
- Why can't my PNG reach the target size?
- PNG compression is lossless, so the quality setting the tool is adjusting has nothing to discard in this build. We measured our 209.6 KB test PNG at 5 KB, 50 KB and 100 KB targets and got the same 177.5 KB file every time. Export it as a JPG or WebP in an image editor on your device first, then compress that copy to your target here.
- What happens if the image can't get under my target?
- You still get a file, and the page tells you the size it actually reached and that your target wasn't met. Quality 5 is the floor: our 529 KB test photo bottomed out at 48.5 KB, so targets of 20 KB or 5 KB came back over. From there, reduce the pixel size yourself or convert to JPG or WebP and try again.
- Are my images uploaded to a server?
- No. The engine is libvips compiled to WebAssembly, downloaded with the page and run inside your browser, so no image bytes are sent anywhere. The page carries no ads or analytics either: that engine only runs on a cross-origin-isolated page, and we leave both switched off on those pages. Close the tab and nothing remains.
- Does the compressed image still contain the GPS location?
- Yes. This tool keeps the whole EXIF block, so the capture time, camera model and GPS coordinates are written into the result — a test photo compressed to 50 KB still read as iPhone 15 Pro at latitude 3.1083. There is no option here to drop it: before publishing a photo, clear the location on your device — Properties → Details → Remove Properties and Personal Information on Windows, or share it from a phone with Location turned off in the share sheet's Options.
- Can I set a target for several images at once?
- No, one image per run. Compress a file, click Start over, and drop the next one — your target size and unit stay as you set them, so each repeat is just drop and click. For a whole folder in one pass you need a desktop or command-line batch tool.