← All posts

How to compress an image to an exact file size

Somewhere out there is a form that will not accept your photo. It wants it under 100KB. Or under 500KB. Or under 2MB. It will not tell you how far over you are, and it will not help you get there — it will just reject the upload and let you work it out.

This is one of those small problems that eats a surprising amount of time, because almost every image tool solves the wrong half of it. Here's why, and how to actually hit a number.

Why the quality slider makes you guess

Most compressors give you a quality slider from 0 to 100. That sounds like it should control file size, but it doesn't — not directly. Quality controls how aggressively the encoder throws away detail. How many kilobytes that saves depends entirely on the picture.

A flat studio shot on white might drop to 80KB at quality 70. A detailed forest scene at the same quality could still be 900KB, because there's far more texture to describe. Same setting, wildly different results.

So you end up in a loop:

  1. Export at quality 80. Check the file. Still too big.
  2. Export at 60. Now it's tiny and looks bad.
  3. Export at 70. Slightly over. Try 68.

That loop is the actual problem. You don't want a quality number — you want a size, and you want the best-looking image that fits inside it.

The right way round: target the size, not the quality

The better approach inverts it. Instead of picking a quality and discovering the size, you state the size and let the encoder find the quality.

Mechanically this is a search. The tool encodes the image, measures the result, and adjusts — higher if there's headroom, lower if it's over — narrowing in until it finds the highest quality that still fits under your limit. It does the guessing loop for you, in a fraction of a second, and it lands on a better result than you'd have the patience to find by hand.

The key detail: you want the largest file that fits under the cap, not just any file under it. A 96KB image looks meaningfully better than a 40KB one, and both satisfy a "under 100KB" rule.

Do it in the browser

The Jump Studio image converter has a target-size field built in, and it runs entirely on your own machine — the image is never uploaded to a server, which matters if it's a passport scan or an unreleased client shot.

  1. Open the converter and drop your image in.
  2. Choose an output format — JPG is the right pick for photos.
  3. Enter your limit in the target size field and pick KB or MB.
  4. Hit export. You get the best-quality version that fits under the number.

It works on a whole batch at once, too, so a folder of images can each be brought under the same cap in one go.

Compress to an exact size

Set a target in KB or MB and export. Free, runs in your browser, nothing uploaded.

Open the image converter →

One thing to know: PNG doesn't work this way

Targeting a file size only makes sense for lossy formats — JPG and WebP. Those have a quality dial to turn.

PNG is lossless. It always reproduces every pixel exactly, so there is no quality setting to trade away, and no way to squeeze it to an arbitrary number. The only lever on a PNG is its dimensions.

So if you're sitting on a huge PNG photo and need it under 200KB, the answer is almost always: convert it to JPG. Photographs should be JPG or WebP anyway — see JPG vs PNG vs WebP for when each one is the right call.

When compression alone can't get you there

Sometimes the target is simply too small for the image's dimensions. A 6000 × 4000 photo squeezed under 50KB will look like wet newspaper no matter how clever the encoder is — there are 24 million pixels and not enough bytes to describe them.

The fix is to resize first, compress second. Halving the dimensions cuts the pixel count to a quarter, which buys you enormous headroom before quality suffers at all.

Where it's goingSensible long edgeRealistic target
Web page / blog image1600–2000px150–300KB
Ecommerce product photo2000–2500px200–500KB
Email attachment1200–1600pxUnder 1MB
Online form / ID upload1000–1500pxUnder 100KB
Full-screen hero image2560px300–600KB

In the converter you can set a long-edge resize and a target size together, so both happen in one pass.

A few things that help

Common questions

How do I get an image under 100KB without it looking terrible?

Resize the long edge to around 1000–1500px first, convert to JPG, then set a 95KB target. At those dimensions 95KB is plenty for a clean-looking image — the usual mistake is trying to hold full camera resolution.

Does compressing an image reduce its dimensions?

No. Compression and resizing are separate. Compression reduces the bytes used to store the same pixel grid; resizing changes how many pixels there are. You can do either, and for tight limits you usually want both.

Is it safe to compress private images online?

It depends entirely on the tool. Most online compressors upload your file to their server to process it. Jump Studio's converter does the work in your browser, so the image never leaves your device — worth caring about for documents and unreleased work.

Can I do this to a whole folder at once?

Yes. Drop a folder in and every image gets the same target and resize settings applied. See batch converting a folder of images.