How to Compress an Image to a Target File Size

Government portals, job applications and exam registrations set hard file size limits, and no image tool can promise an exact byte count in one pass. Two settings do almost all the work, and knowing which one to reach for first turns this from guesswork into two attempts.

By ZyffPublished 9 min read

The short version

  • Resize before you reduce quality. Pixel count drives file size harder than the quality slider does.
  • Quality 75 to 80 is the useful floor for photographs. Below about 60 the damage becomes obvious on skin and gradients.
  • Expect two passes. Compress, read the actual output size, then adjust once — one shot at a number is luck, not method.
  • If the form accepts WebP or AVIF, changing format is the cheapest saving available.
  • Check the limit's units. Many portals mean KB as 1,000 bytes, and a 102KB file fails a 100KB check.

The request looks simple — make this photo 100KB — but no encoder can honour it directly. A JPEG or WebP encoder takes a quality target, compresses, and produces whatever size that image happens to need. Two photographs at identical dimensions and identical quality can differ threefold in bytes, because a flat studio background compresses to almost nothing while foliage or a crowd does not. That is why tools promising an exact size internally compress several times and keep the closest result, and why doing the same thing deliberately gets you there faster.

There are only two levers that matter, and they are not equally strong. Pixel count is the first and by far the larger: file size scales roughly with the number of pixels, so halving both width and height removes about three quarters of the data before quality is touched at all. Quality is the second, and it has a floor below which the image visibly falls apart. Most people drag quality down to 20 while leaving a 4000-pixel-wide photo untouched, get a muddy 300KB file, and conclude the limit is impossible. Resizing first and leaving quality near 75 almost always beats it.

Format is a third factor people forget. The same picture at the same visual quality is meaningfully smaller as WebP than as JPEG, and smaller again as AVIF. If the form accepts WebP, switching format can clear the limit on its own with no quality loss at all. If it only accepts JPG — which most official portals do — that lever is unavailable and the first two have to carry it.

Why no tool can promise an exact file size

Lossy image compression works by discarding detail the eye is least likely to miss, and how much detail exists is a property of the picture. A quality setting is an instruction about how aggressively to discard, not a promise about the result. Feed the encoder a photograph of a white wall and quality 80 might produce 40KB; feed it a market stall at the same size and quality and it might produce 400KB. Nothing is wrong in either case.

This is why the honest workflow is measurement, not prediction. Compress once at a sensible starting point, read the exact output size, and you now know something specific about this image rather than something general about the setting. A second pass informed by that number lands close, and a third is rarely needed. Tools that advertise an exact target size are running this loop for you, several times, and returning the nearest hit.

The two levers, in the order you should use them

Start with dimensions. A photograph straight off a modern phone is somewhere between 3000 and 4500 pixels on its long edge — far more than any web page, upload form or printed ID photo needs. Reducing the long edge to 1600 pixels cuts the pixel count of a 4000-pixel image by roughly 84%, and file size falls in rough proportion. Nothing about the visible quality of the image at normal viewing size changes, because the extra pixels were never being displayed.

Then adjust quality, and adjust it gently. The perceptual cost of quality is not linear: dropping from 95 to 80 is nearly invisible and saves a great deal, dropping from 80 to 65 is noticeable on faces and smooth gradients, and below 60 you get visible blocking around hard edges and banding in skies. If a target needs quality below 60, the image is still too large in pixels — go back to the first lever.

Only when both are exhausted should you consider cropping. Removing content is a real change to the image rather than a compression decision, so it belongs last, but it is legitimate when a photo has wide empty margins that carry no information.

  • Long edge 1600px is a safe default for web use and almost any upload form.
  • Long edge 800px suits thumbnails, avatars and email signatures.
  • Quality 80 for photographs; 90 or above for screenshots and flat graphics with hard edges.
  • Quality below 60 is a signal to resize further, not to accept the artefacts.

Recipes for common targets

These are starting points for a typical phone photograph, not guarantees — a busy image will land above the estimate and a simple one below it. Use them for the first pass, read the real output, then adjust. All of them assume JPEG output, because that is what portals with size limits almost always require.

TargetLong edgeQualityTypical use
Under 20KB480px70Small avatars, forum icons
Under 50KB800px70ID photos, exam form portraits
Under 100KB1200px75Job application attachments, most government portals
Under 200KB1600px78Blog images, product listings
Under 500KB2000px82Full-width hero images
Under 1MB2560px85High-detail photography, print previews
First-pass settings by target size, for a typical phone photo in JPEG

Read the limit carefully before you start

Two ambiguities cause most rejected uploads, and neither is about compression. The first is what KB means. A strict reading is 1,024 bytes, but plenty of forms are written against 1,000, and some validate on the number their own operating system reports. A file at 102,000 bytes reads as 99.6KB one way and 102KB the other, and only one of those passes a 100KB check. Aim a little under the stated limit rather than at it.

The second is whether the limit applies per file or per submission. A form allowing 200KB per image and 1MB in total will accept five images individually and reject the set. Add up the compressed sizes before submitting, and if the total is the binding constraint, spend the budget where it matters — the portrait can afford more bytes than the signature scan.

Some portals also enforce a minimum dimension alongside a maximum file size, which is the one combination that makes the first lever unavailable. Where a form demands, say, at least 600x600 pixels and under 50KB, you cannot resize below 600 and must reach the target on quality and format alone.

When the image is a scan or a screenshot, change approach

Everything above assumes a photograph. Documents and screenshots behave differently, because their content is large flat areas and hard black edges — exactly what JPEG handles worst. A scanned form at JPEG quality 70 develops grey haloes around every letter, and the file is often larger than a lossless version would have been.

For text-bearing images, keep quality high — 90 or above — and take the saving from dimensions instead, since text stays legible at surprisingly low resolution. Where the format is your choice, PNG is frequently both smaller and cleaner for screenshots of interfaces, and WebP handles the mixed case of a screenshot containing a photograph better than either.

Try it on Image Compressor

Free, no signup, no watermark. Runs on Zyff’s servers, so you get the same result on a phone as on a desktop.

Open the tool

How to compress an image to a specific file size

  1. Note the real limit

    Write down the exact ceiling and whether it is per file or per submission, and aim about 10% under it to absorb the KB ambiguity. Check for a minimum dimension requirement too, since that decides whether resizing is available to you.

  2. Resize first

    Open Zyff's image resizer and bring the long edge down to the value from the recipe table — 1200px for a 100KB target on a photograph. This is the single largest saving available and it costs nothing visible at normal viewing size.

  3. Compress at a sensible quality

    Move to the image compressor, choose the format the form requires, and set quality to about 78 for a photograph. Resist starting lower; the point of the first pass is to learn what this image costs, not to hit the number.

  4. Read the actual output size

    The results row reports the exact compressed size in bytes. Compare it with your target. If you are within about 15% you are one small adjustment away; if you are double, the image is still too large in pixels.

  5. Adjust once and re-run

    Over target by a little: drop quality 5 to 8 points. Over by a lot: go back and reduce the long edge again rather than pushing quality below 60. Re-compress and check the size again.

  6. Confirm it still looks right

    Use the before and after comparison to check faces, skies and any text in the image at full size. A file that meets the limit but shows visible blocking has solved the wrong problem, and one more resize-and-recompress cycle usually fixes it.

At a glance

Quality range10 to 100, adjustable in single steps
Output formatsWebP, JPEG, PNG, AVIF
Built-in resizeOptional cap on the long edge, up to 1600px
Upload ceiling25 MB per image
PNG behaviourAlways lossless, so the quality slider is disabled for it
PriceFree, no account needed

Frequently asked questions

How do I compress an image to exactly 100KB?

You cannot hit an exact byte count in one pass, so compress once and adjust. Start by resizing the long edge to about 1200px, set JPEG quality to 78, and read the output size — then drop quality a few points if you are over. Aim for 90KB rather than 100KB, because some forms treat a kilobyte as 1,000 bytes and others as 1,024.

Should I resize or lower quality to reduce file size?

Resize first, almost always. File size scales with pixel count, so halving the width and height removes roughly three quarters of the data with no visible change at normal viewing size. Quality has a hard floor around 60 for photographs, below which artefacts become obvious, whereas a phone photo has thousands of pixels nothing is displaying.

What quality setting should I use to compress a photo?

Use 80 for photographs, 90 or above for screenshots and flat graphics, and 70 when you need a small file and the image will be viewed small. Below 60 you get visible blocking around edges and banding in skies. If a target size needs quality under 60, reduce the dimensions instead.

Why is my compressed image still too big?

Almost always because the pixel dimensions are unchanged. A 4000px-wide phone photo carries far more data than any form needs, and no quality setting compensates for that. Resize the long edge to 1200 or 1600 pixels first, then compress — that ordering clears most limits on the first or second attempt.

Does compressing an image to a smaller size lose quality?

It depends on the format. JPEG, WebP and AVIF are lossy, so detail is discarded permanently — though at quality 80 the difference is very hard to see on a photograph. PNG output is lossless, so pixels come back identical, which is why it cannot be made smaller by a quality setting at all.

What if the form requires a minimum resolution and a maximum file size?

Then resizing is capped and you have to reach the target on quality and format alone. Keep dimensions just above the stated minimum, use JPEG if the form allows nothing else, and work quality down in small steps from 80. If the combination is genuinely impossible, cropping tighter around the subject reduces pixels without going below the minimum on the remaining area.

Can I compress several images to the same size at once?

Zyff's compressor works on one image at a time so you can check each result, which matters when a size limit is strict. The format converter accepts a batch and returns a ZIP, which suits a set of images that only need to be roughly smaller rather than each under a specific ceiling.

Sources and further reading

More guides