Pixel Dock
image tools · nothing leaves your browser

Compress an image to an exact file size

Type the number the upload form is demanding — 200KB, 2MB, whatever it is — and this finds the highest image quality that fits under it. Your photo is never uploaded anywhere.

Target file size
KB

Why the number matters

Almost nobody wants "a smaller image." They want to get past a form that rejected their photo. Job application portals cap résumé photos at 100KB. Government and visa uploads often stop at 200KB. Forums, ticketing systems, and older content management systems set limits that were reasonable in 2011 and never got revisited. Email attachments are the same story at a larger scale.

Most compression tools give you a quality slider and let you guess. That means exporting, checking the size, going back, nudging the slider, and repeating. This page does the guessing for you: it encodes your image at several quality settings, measures each result, and keeps the best one that lands under your number.

How the search works

Image quality and file size don't have a tidy relationship — it depends entirely on the picture. A photo of a blank wall stays tiny at maximum quality. A photo of gravel or foliage is enormous at the same setting. So there is no fixed quality value that means "200KB."

Instead, this runs a binary search. It encodes at one quality setting, measures the result, and depending on whether that came in over or under your target, tries halfway up or halfway down. Nine rounds narrows the range to under a quarter of a percent — close enough that another round wouldn't change anything you could see. The strip of ticks on each result is every attempt it made: teal came in under your target, pink came in over, green is the one that was kept.

The search has a floor at quality 55, which is roughly where JPEG artifacts stop being subtle. It will not go below that line while there are still pixels it could give up instead. So when a 48-megapixel photo won't fit in 50KB, the image gets smaller rather than uglier, and the result tells you the new dimensions. A sharp 900px photo is more useful than a smeared 4000px one, and every tool that only moves the quality slider gets this backwards.

You can overrule that with the shrink checkbox, which keeps the original dimensions and lets quality fall as far as it needs to. The result will say so when that happens.

JPEG or WebP?

PNG isn't offered as an output here. It's lossless, so there's no quality dial to search along — a photo saved as PNG will usually be several times larger than the JPEG, not smaller.

What happens to your photo

Nothing is uploaded. The image itself never goes to a server — all the decoding and re-encoding runs in your browser using standard canvas APIs, right in the tab you're looking at. You can watch it in your browser's Network tab: the page loads, but your photo is never sent anywhere. That's not a privacy policy you have to trust; it's just how the page is built.

One consequence worth knowing: re-encoding strips EXIF metadata. Your GPS coordinates, camera model, and timestamp will not survive into the compressed file. For most uploads that's a feature. If you specifically need to keep that data, compress a copy.

Rotation is handled separately. Photos from phones are frequently stored sideways with an orientation flag telling the viewer to rotate them, and naive compressors drop that flag — which is why images sometimes come out of other tools lying on their side. This page reads the flag and bakes the rotation into the actual pixels before compressing.

Getting a better-looking result