Compress to Target Size
Name a figure in KB or MB, and the picture is worked down until it fits under it.
What this tool does
Compress to Target Size works backwards from a number. You give it a budget, and it searches the encoder's quality scale for the highest setting whose output still fits underneath: the first candidate is written at quality 80, and each following one halves the range that is still in play, between a floor of 5 and a ceiling of 95. That search runs to eight encodes, or stops sooner once the remaining range is under two quality points. Nothing here is estimated — every candidate is genuinely encoded and its bytes counted, so the size quoted in the result is the size of the file that lands in your downloads.
Quality is not always enough on its own. When the lowest quality tried is still over budget and “Shrink the dimensions” is left ticked, the picture is redrawn at 80% of its width and height and the whole quality search runs again. There are eight of those passes in all, so seven shrinks at most, which bottoms out at roughly a fifth of the original width — a photograph that still does not fit by then is handed back at that size rather than shrunk further. Smaller pictures stop before that, because no side is taken below 64 pixels. Three output formats are offered — JPG, WebP and AVIF — and PNG is deliberately missing from that list, because PNG is lossless, has no quality dial to turn, and therefore cannot be aimed at a size budget at all.
A budget can simply be impossible, and this is where the tool has to be believed rather than admired. If the passes run out at the lowest quality with the file still above your figure, what comes back is the smallest version it managed, the size that version actually reached, and a plain “no” against the target — not a quiet miss. Two other behaviours are worth knowing in advance. An image already under the budget in the format you asked for is handed back byte for byte, because re-encoding a small file can easily make it larger — and because those bytes are untouched, that copy keeps whatever EXIF it arrived with. Everything that is genuinely re-encoded is redrawn on a canvas first, so camera model, capture date and GPS position are dropped from those results.
The work happens inside this browser tab, through the same canvas encoder the browser uses to write images anywhere else, so the picture is not uploaded and the page keeps working with the network switched off. That is also where the boundary sits. The browser has to be able to decode what you feed it — HEIC photos from an iPhone cannot be decoded by any browser, and the HEIC Converter handles those on the server instead — and it has to be able to write the format you picked. AVIF writing only exists in recent browsers; where it is absent the job stops and asks you to choose JPG, rather than handing you a mislabelled file.
How to use it
- Add the images. Anything the browser can decode is accepted: JPG, PNG, GIF, BMP, WebP and SVG, with AVIF on recent browsers. Several at once is fine — each is aimed at the budget on its own, rather than sharing one between them.
- Type the figure and pick the unit. 200 KB to start with, in KB or MB. A KB is 1024 bytes here, and a budget under half a kilobyte is refused as being smaller than an image file header.
- Choose the output format. JPG is the dependable choice for a size limit, WebP is smaller at the same quality, and AVIF smaller still where the browser can write it.
- Decide whether the pixels may shrink. Shrinking is allowed by default and is what rescues a large photograph aimed at a small figure. Untick it to hold the original width and height and take whatever quality alone can reach.
- Check the figures before downloading. The result reports the size reached, the quality it settled on, whether your target was met, and the new dimensions if it had to resize to get there.
Processing & privacy
Runs on your device. Your file is processed directly in this browser.
Common use cases
Meeting a form's stated cap
Job portals, exam boards and visa applications name a figure and reject anything above it — the photograph must be under 200KB, the scan under 1MB. Type that number instead of guessing at a quality slider and re-uploading.
Keeping a page's images inside a performance budget
A front-end budget is usually expressed in kilobytes per image. Setting the size limit directly is faster than compressing, measuring, and compressing again.
Preparing a set of listing photographs
Marketplaces and classified sites cap each upload separately. Queue the whole set and every picture is brought under the same figure individually.
Attaching a photograph to a bug report or ticket
Issue trackers and chat tools cap attachments at a few megabytes. One pass at an exact KB figure is enough to get a screenshot through without cropping it.
Questions
Is my photograph sent anywhere?
Why did it stop above the figure I asked for?
Why is PNG not an output option?
Will the result be exactly the size I typed?
What happens to a transparent background?
Is a KB counted as 1000 or 1024 bytes?
Nothing happened to my file — why?
Related tools
- Image Compressor — Shrink JPG, PNG and WebP files with a quality you control.
- Resize Image — Change pixel dimensions with aspect-ratio locking.
- Convert Image — Convert between JPG, PNG, WebP, AVIF and GIF.
- PNG to JPG — Convert PNG files to smaller JPG images.
- HEIC Converter — Convert iPhone HEIC photos to JPG or PNG.
- Crop Image — Crop freely or to a preset ratio.