Skip to content
Private by design — every tool runs on your device · No upload · No watermark · No account
P pixelshift.
November 30, 2026 · compression· file size· workflow

Hit an exact image file size

How to reach a hard upload limit such as 200 KB or 2 MB: why target-size compression uses binary search, when quality settings stop helping, and what to verify before submitting.

Upload forms rarely care how beautiful your photograph is. They care about bytes. A government portal that caps attachments at 200 KB, a marketplace that rejects anything over 2 MB, an email thread with a strict limit — all of them will refuse a file that is a few kilobytes too large. Meeting the number without visibly damaging the image takes a different approach from simply dragging a quality slider.

Image compressor console with quality controls and target file size input
Setting a target size lets the encoder work backwards from the limit instead of guessing at a quality value.

Why a quality slider is the wrong tool for a hard limit

A quality control is relative. It says how much detail to keep, not how many bytes will come out. Two photos exported at the same quality can differ by a factor of five because one contains fine grass and fabric texture while the other is a smooth wall. If you set quality to 70 and hope for the best, you will sometimes land well under the limit with quality to spare, and sometimes miss it by a wide margin.

That uncertainty is fine for general web work and terrible for a form that either accepts your file or does not. With a hard cap, the goal is not a pleasant-looking quality number. It is the largest, cleanest file that still fits. You want the encoder to answer the size question directly.

How target-size compression works

Behind the scenes, the tool can encode the same image repeatedly at different settings and compare each result to your target. It searches the range of useful settings — a process often described as binary search — and converges on the setting that gets closest without going over. You supply the limit; the encoder does the arithmetic.

Three engines handle the work. JPG files go through MozJPEG, WebP through libwebp, and PNG through OxiPNG. They run in your browser, so the original never leaves your device. On the first export the page fetches a small codec engine of roughly 100 to 300 KB. It is cached afterwards, which means subsequent exports are quick and continue to work offline. That one-time fetch is worth noting if you are on a slow connection, but it is far smaller than the images you are trying to shrink.

Choose the format before the target

The target size is only meaningful once the format is settled. For a photograph, JPG or WebP will reach a given size with much better detail than PNG, because PNG stores every pixel losslessly. Converting a photo to PNG to “keep quality” before compressing it is the fastest way to miss a small limit. If transparency is not part of the image, do not pay for it.

WebP often reaches the same visual quality at a smaller size than JPG, but compatibility is the deciding factor. If the upload form or its downstream reader is old and only accepts JPG and PNG, a clever WebP file will be rejected outright. Check what the destination accepts before you spend time tuning the number. If a format change is needed, the format converter handles PNG, JPG and WebP locally, and the resizing tool can bring the pixel dimensions down first — the single most effective way to make a small target achievable.

When the target is unreachable

Every image has a floor. At 200 KB, a 6000 by 4000 photo of a crowded street will look visibly damaged no matter how efficient the encoder is. A good target-size tool should tell you when the requested limit cannot be met at an acceptable quality instead of quietly returning a blotchy file. Treat that message as useful feedback: the problem is the pixel count, not the quality setting.

The fix is to reduce dimensions before compressing. Displayed at 800 pixels wide, a photo does not need 6000 pixels of source data. Halve the width and height and you remove about three quarters of the pixels, which frees the encoder to spend its byte budget on the pixels that remain. Only after that should you set the hard target. This order — resize, choose format, then target size — is what separates a clean 200 KB image from a compressed mess at the same size.

A worked example: a 200 KB form

Suppose a job application portal wants a portrait under 200 KB and accepts JPG or PNG. Start by opening the photo in the resizer and setting the long edge to about 1200 pixels with the ratio locked. Export it. If the image is a portrait with a plain background, PNG might still be reasonable; for almost any other photograph, choose JPG.

Next, enter 200 KB as the target in the compressor and let the search run. Open the result at full size and look specifically at the eyes, hair edges and the background immediately behind the head. Those are the areas where compression shows first. If the result looks clean, you are done. If edges are smeared, go back and reduce the dimensions a little further, then try the target again. The byte budget stays the same, but fewer pixels have to share it.

Mistakes worth avoiding

Aiming far below the limit. If the cap is 200 KB, do not ask for 120 KB out of habit. You are throwing away quality you were allowed to keep. Aim close to the cap and leave a small margin for rounding.

Using one target for every image. A simple logo and a detailed landscape do not reach 200 KB the same way. Let the search work per file rather than reusing a quality number across a batch.

Forgetting about metadata. Embedded camera data and colour profiles add bytes that do nothing for the visible image. A local export usually strips the extras, which is another reason to re-encode rather than rename the original.

Judging at thumbnail size. Compression artifacts hide in small previews. Always inspect at one hundred percent.

A short checklist

Confirm the accepted formats and the exact cap. Resize to the largest size the image will actually be displayed at. Pick the format that suits the content. Set the target just under the limit. Inspect one full-size export. Repeat with smaller dimensions only if the result looks damaged.

Hard limits stop being frustrating once you stop treating them as a quality setting and start treating them as a constraint the encoder can solve. The whole workflow — resizing, converting and compressing — runs locally, so you can iterate as many times as the result demands. More detail on related decisions lives in the guide index and the browser homepage.