How to Compress an Image to an Exact File Size in KB

Updated

How to Compress an Image to an Exact File Size in KB

No compressor has a true “compress to X KB” input — file size is an output, not a setting. To hit an exact target, resize the image first, export as JPG at a chosen quality, read the resulting size, then nudge the quality and repeat. Two or three passes usually land it.

Do it now — free, in your browser

Compress your image free

Why no tool has a real “compress to X KB” box

Every image compressor gives you the same two real controls: a quality slider and an optional maximum dimension. File size is what comes out the other end — it depends on how much detail, noise and colour variation your particular image contains, so the same quality setting produces a 38 KB file from one photo and a 95 KB file from another. That is why EditItAll’s compressor, like every honest tool, has no “compress to 20 KB” input: no encoder can promise an exact byte count in advance.

The good news is that you do not need one. Because the results list shows each file’s size the moment it is re-encoded, you can steer to any target in two or three quick passes — the loop below works for exam portals, visa forms, CMS limits and everything in between. For the general principles of shrinking images while keeping them presentable, see compressing images without losing quality.

The three-pass loop that lands any KB target

  1. Resize first. Dimensions move file size far more than quality does. A 4000-pixel photo destined for a 50 KB slot should be capped at 800–1000 pixels on its longest side before you touch quality — set the max-dimension option in the JPG compressor and the biggest drop happens immediately.
  2. Pick the right format. Photos and scans belong in JPG. Flat graphics — logos, line art, screenshots of text — stay sharper in PNG, so run those through the PNG compressor instead (see compressing PNG without losing quality). A photo saved as PNG will fight you; convert it to JPG first.
  3. Set a quality and read the result. Start around quality 80, export, and read the per-file in → out size in the results list. Too big? Drop quality ten points. Comfortably under? Raise it and claw back sharpness. Two or three nudges usually land within a kilobyte of the target.
  4. Aim a notch under the limit. The size readout rounds to whole kilobytes, so a file showing “20 KB” can really be 20.4 KB — enough to fail a strict 20,480-byte check on a government portal. When a form says 20 KB maximum, stop at 19 KB and it will never bounce.

Common targets and the fastest route to each

  • 10–20 KB — signatures and tiny thumbnails. The smallest targets are dimension games: a signature cropped to 300–400 pixels wide reaches 20 KB at moderate quality. Exam and government portals are the classic case — the photo and signature guide for government forms walks through the exact specs.
  • 50–100 KB — form photos and profile pictures. Cap at 600–1000 pixels and quality 70–85 gets there. For the most-requested number on the web there is a dedicated walkthrough: compress an image to 100 KB.
  • 200–500 KB — web pages and listings. Keep 1200–1600 pixels for crisp display and let quality 75–85 find the size.
  • 1 MB — email, CMS and upload caps. The easiest target of all; a dimension cap alone often does it — details in compress an image to 1 MB.

Batches, privacy and offline use

Hitting one target for fifty files is the same loop run once: drop the whole set into the image tools, apply one quality and dimension setting, then scan the results list for any file still over the line and re-run just those a notch lower. The batch compression guide shows the flow, ZIP download included.

Everything happens right on your device: images are never uploaded, EXIF and GPS metadata are stripped on export, and once the page has loaded the compressor keeps working offline. That matters precisely for the files exact-size rules attach to — ID photos, signatures and scanned documents. There is no account, no watermark and no file limit.

Ready to try it?

Free, no sign-up, and nothing you open ever leaves your device.

Frequently asked questions

Why does the same quality setting give different sizes for different images?+

Compression removes redundancy, and every image has a different amount of it. A smooth studio portrait shrinks dramatically at quality 80, while a detailed landscape full of foliage keeps far more data at the same setting. Size always depends on image content, which is why no tool can promise an exact byte count in advance.

The readout says 20 KB but the upload portal still rejects the file. Why?+

Displayed sizes round to the nearest kilobyte. A file showing 20 KB can actually be 20.4 KB — roughly 20,900 bytes — while a strict portal enforces 20,480 bytes. Re-compress one quality notch lower so the readout shows 19 KB and the check will pass.

Should I lower quality or resize the image first?+

Resize first. Halving the pixel dimensions removes about three quarters of the data before any quality loss, so you reach small targets while keeping the quality setting — and visible sharpness — much higher. Use the quality slider only for the final fine-tuning passes.

The form wants a small JPG but my file is a PNG. What should I do?+

Convert it to JPG first, then compress. Photographic PNGs are several times larger than an equivalent JPG, so even maximum PNG compression may never reach a 50 KB target that JPG hits comfortably at quality 80. Keep PNG for flat graphics like logos and line art.

Is it safe to compress ID photos and signatures this way?+

Yes — files are processed right on your device and never uploaded to a server. Location and camera metadata are stripped on export, and the tools keep working offline once the page has loaded, so sensitive documents stay entirely in your hands.

Related guides

More guides on compressing images →