Compress Image to Exact Size (KB)

Compress an image to an exact target file size in KB or MB. The tool searches the encoder quality and, if that is not enough, scales the image down until the result fits under the limit you set. Useful for upload forms that reject files above a fixed size.

Free online tool · Image Tools · No installation · No sign-up required

Overview

Many upload forms state a hard limit: a passport portal that refuses anything above 200 KB, a job board capped at 1 MB, a government form that requires the file to be under 500 KB. Resizing by eye rarely lands under the limit, and lowering the quality slider by hand means exporting and checking the size over and over. This tool automates that loop. You type the size you need, and it finds an encoder setting that produces a file at or below that size.

The search works in two stages. First the tool binary-searches the JPEG or WebP quality value, trying the midpoint of the current range and narrowing it based on whether the encoded result was above or below your target. If the lowest reasonable quality still produces a file that is too large, the tool scales the image down by ten percent and searches again, up to twelve times. Every result is measured by encoding it and reading the real byte length, so the size you are shown is the size you get, not an estimate.

PNG behaves differently and the tool is explicit about it. PNG is a lossless format, so there is no quality dial to turn: the only way to make a PNG smaller is to store fewer pixels. Choosing to keep PNG therefore reduces the dimensions, which is why the tool recommends converting photographs to JPEG and reserving the PNG option for images that need transparency or crisp text. If a target turns out to be unreachable, the tool says so and returns the smallest file it actually produced rather than silently pretending to have met the target.

Worked example

A 3.1 MB phone photo reduced to 97 KB for an Indonesian recruitment portal

An applicant in Surabaya is filling a recruitment form that refuses any upload above 100 KB. The photograph from the phone is a 3024 × 4032 px JPEG of 3.1 MB, and it still has to be recognisable at the small size printed on the form.

  1. Drop the file into the box, then click the 100 KB preset button. The unit switches to KB and the target box reads 100.
  2. Leave the PNG strategy panel alone, because the file is a JPEG. Leave Max width and Max height empty so the pixel dimensions are not touched unless they have to be.
  3. Press Compress image to 100.0 KB. The status line narrates the search: Searching quality — attempt 1/10 (2.48 MB), then attempt 2/10, and so on, with the measured size of every attempt.
  4. Continue reading the first row when it appears. It shows 3.1 MB to 97.4 KB, the dimensions 3024×4032 for both sides, the JPEG format, and a green Target met badge.

Result: The search settles at about 31 percent quality and reports 97.4 KB while keeping the full 3024 × 4032 px, so nothing had to be downscaled. The download is named foto-ijazah-97kb.jpg, with the achieved size in kilobytes in the file name. Had the target been out of reach at full size, the next step would have been shrinking the image by 10 percent and searching quality again, up to twelve times.

How to use Compress Image to Exact Size (KB)

  1. Add one or more images
  2. Type the target size and choose KB or MB
  3. Optionally set a maximum width or height
  4. Run the compression and download the results

Common mistakes

Choosing "Keep PNG (lossless)" for a photograph and typing a 20 KB target.

A lossless PNG can only get smaller by using fewer pixels, so a small target is often unreachable and the tool will say so rather than claim success. Choose "Convert to JPEG (recommended for photos)", which enables the quality search and reaches small targets. Keep PNG only when transparency must survive.

Typing 0.1 MB because the form says 100 KB. 0.1 MB is 104858 bytes, which is 102.4 KB and over the limit.

Use the unit the form uses. The preset buttons set exact KB values, and 100 KB here means 102400 bytes, which the tool treats as the ceiling.

Running the downloaded file through the tool a second time to shave off a few more kilobytes.

The first run already measured the smallest output it could produce at that target. A second pass re-encodes an already-compressed JPEG, losing more detail for very little gain.

Leaving a small Max width from an earlier attempt and losing resolution for no reason.

Keep the max width and height boxes empty unless a portal states a pixel limit. The quality search alone usually reaches the KB target, and empty boxes mean the pixels are only touched when the size cannot be reached otherwise.

Features

Limits worth knowing

When to use it

Practical tips

Why use this tool

When this is not the right tool

Frequently asked questions

Does it really hit the size I type?

Yes, when the target is achievable. Every candidate is encoded and measured, and the tool reports whether the target was met. If it cannot be met it tells you and returns the smallest file it produced.

Why is my PNG still large?

PNG is lossless, so there is no quality setting to lower. Reducing a PNG means storing fewer pixels, which is why the tool suggests JPEG for photographs.

Are my images uploaded?

No. The whole process runs in your browser using canvas, so your files never leave your device.

Will the dimensions change?

Only if compression alone cannot reach the target, or if you set a maximum width or height. The result panel shows the source and output dimensions.

Related tools in Image Tools