Compress Image to Exact Size

Hit a precise KB or MB target — pick a preset like 20KB or 200KB, or enter a custom size. Runs entirely in your browser.

Compress to a target size

Upload an image, choose a target size, then download a JPG that fits it.

Drag & drop an image here, or click to browse
Supports JPG, PNG and WEBP.

    Result

    Original size
    0 KB
    Final size
    0 KB
    Target
    0 KB

    Compressed image preview
    Preview
    Your image is processed locally in this browser tab using the Canvas API. It is never uploaded to Calcooo or any server.

    How to use this tool

    1. Drag and drop an image into the box above, or click to browse and select one.
    2. Pick a quick preset (e.g. 100 KB) or enter a custom target size and unit.
    3. Press Compress to target — the tool searches for the best quality that still fits your target.
    4. Click Download image to save the result, which will be at or just under your target size.

    Frequently asked questions

    Is my image uploaded anywhere?

    No. The target-size search runs locally in your browser using the Canvas API — nothing is uploaded.

    How does hitting an exact size work?

    The tool repeatedly re-encodes your image as JPEG at different quality levels (a binary search) until it finds the highest quality that still fits under your target size. If quality alone can't reach the target, it also slightly reduces the image dimensions and tries again.

    Why does the output become a JPG even if I uploaded a PNG?

    Precise size control depends on JPEG's adjustable quality setting — PNG is lossless and can't be fine-tuned the same way. If your image needs transparency, exact-size targeting isn't suitable since it always exports as JPEG.

    Can I get exactly 20KB, or just close to it?

    The tool aims to land at or just under your target size — for common presets like 20KB or 100KB it's typically within a few percent, close enough for form uploads and portals with a strict size limit.