Free tool · JPEG output · Runs in your browser

Compress an image to a target size

No uploadRuns in your browserReviewed October 9, 2026

Short answer

Pick a limit from 20 KB to 1 MB, or type your own, and the tool searches the JPEG quality for the best picture that fits. When even a low quality is too big, it shrinks the picture as well and tells you the new size. In our tests across four images and six targets, quality alone missed 12 of 24, including every target up to 100 KB for the 3.1 MB photo; the tool fit 24 of 24. Nothing is uploaded.

Exact selected target: 102,400 bytes. These existing KB controls use 1,024 bytes per unit; a decimal search preset retains its exact byte count.

Choose an image after setting the target.

Output is JPEG, because quality-versus-size can be searched reliably for it. The result may be below or above the target; the actual size and any unreachable target are reported. An exact byte count cannot be promised. Quality is searched first; the picture is shrunk only when quality alone cannot reach the target, and the result list shows the new size. Untick the option to keep the dimensions and trade quality only.

Key takeaways

  • Quality alone often cannot reach a small target. For the 3840 × 3877 photo, the smallest quality the search tries gave 185 KB, so 20, 50 and 100 KB were all out of reach, and the 200 KB target was met only at 5% quality (SSIM 0.68).
  • With the shrink option the portrait fit 20 KB as 295 × 368 at 76% quality (19 KB, SSIM 0.92); quality alone left 51 KB at SSIM 0.74.
  • The search puts quality first: it only shrinks the picture when the quality floor of 50% is not enough, then spends what is left on quality again. Where quality alone was enough, such as the document at 500 KB, the picture was left at its full size.
  • It takes 3 to 16 encodes and 0.1 to 1.7 seconds in headless Chromium, the longest on the 29 megapixel PNG.
  • The result is a JPEG, so a PNG with transparency becomes a JPEG on a white background. KB here means 1,024 bytes; a 100 KB target is 102,400 bytes.

What the tool does

The search runs in your browser and measures every file it makes, so the size it reports is real. It works in three steps.

StepWhat it doesWhen it stops
1. Quality at full sizeEncodes at 50% quality. If that fits, searches 50% to 95% for the highest quality that doesNothing is shrunk; if 50% is already over the target, go to step 2
2. Find a sizeAt 75% quality, finds the largest scale that fitsAbout nine tries, or when within 10% under the target
3. Spend what is leftSearches quality again at that scaleThe highest quality that still fits

The size search of the Compress an image to a target size tool.

Untick the shrink option and the tool works as quality only, down to 5% quality, and tells you when the target cannot be reached. Drawing uses the browser's high quality smoothing when it shrinks; MDN describes imageSmoothingQuality as low, medium or high.

Measured: quality only

Measured in headless Chromium with the browser's own canvas JPEG encoder, the way the tools draw: a white background, then toBlob at the quality given. Five public domain images: a 3840 × 3877 photo (3.1 MB), a 2122 × 2644 portrait (733 KB), a 3827 × 1588 handwritten document scan (1.36 MB), a 5380 × 5432 PNG graphic with transparency (18.9 MB) and a small 441 × 517 JPEG (66.6 KB). SSIM compares each result with the original at the result's own size, so 1.0 would be identical. Other browsers use their own encoders, so sizes can differ.

This is what the tool does with the shrink option unticked: the quality search alone, with the lowest quality it will try set to 5%.

Quality only
TargetPhotoPortraitDocument scanGraphic (PNG)
20 KB185 KB (over), 5%, SSIM 0.6851 KB (over), 5%, SSIM 0.74101 KB (over), 5%, SSIM 0.84307 KB (over), 5%, SSIM 0.55
50 KB185 KB (over), 5%, SSIM 0.6851 KB (over), 5%, SSIM 0.74101 KB (over), 5%, SSIM 0.84307 KB (over), 5%, SSIM 0.55
100 KB185 KB (over), 5%, SSIM 0.6896 KB, 16%, SSIM 0.84101 KB (over), 5%, SSIM 0.84307 KB (over), 5%, SSIM 0.55
200 KB185 KB, 5%, SSIM 0.68181 KB, 36%, SSIM 0.89188 KB, 16%, SSIM 0.88307 KB (over), 5%, SSIM 0.55
500 KB452 KB, 16%, SSIM 0.73493 KB, 70%, SSIM 0.95477 KB, 61%, SSIM 0.93488 KB, 11%, SSIM 0.87
1 MB922 KB, 39%, SSIM 0.88981 KB, 95%, SSIM 1.001020 KB, 84%, SSIM 0.97945 KB, 28%, SSIM 0.91

The shrink option unticked, quality searched down to 5%): size reached, quality used and SSIM. "Over" means even the lowest quality missed the target.

Quality alone missed 12 of 24 targets, and 5 more were met only at 20% quality or lower.

Measured: quality and size together

The same images and targets with the shrink option on, which is the default.

With the shrink option
TargetPhotoPortraitDocument scanGraphic (PNG)
20 KB306 × 309, 76%, 19 KB, SSIM 0.94295 × 368, 76%, 19 KB, SSIM 0.92504 × 209, 75%, 20 KB, SSIM 0.91269 × 272, 80%, 20 KB, SSIM 0.87
50 KB506 × 510, 75%, 50 KB, SSIM 0.92547 × 682, 76%, 49 KB, SSIM 0.92930 × 386, 75%, 50 KB, SSIM 0.91509 × 513, 75%, 50 KB, SSIM 0.89
100 KB762 × 769, 76%, 96 KB, SSIM 0.93862 × 1074, 76%, 93 KB, SSIM 0.911271 × 527, 76%, 97 KB, SSIM 0.93748 × 755, 76%, 96 KB, SSIM 0.89
200 KB1104 × 1115, 75%, 198 KB, SSIM 0.931303 × 1624, 76%, 191 KB, SSIM 0.921924 × 798, 75%, 197 KB, SSIM 0.931227 × 1239, 78%, 197 KB, SSIM 0.91
500 KB1902 × 1920, 76%, 483 KB, SSIM 0.912122 × 2644, 70%, 493 KB, SSIM 0.953827 × 1588, 61%, 477 KB, SSIM 0.932186 × 2207, 78%, 488 KB, SSIM 0.92
1 MB2700 × 2726, 76%, 976 KB, SSIM 0.912122 × 2644, 95%, 981 KB, SSIM 1.003827 × 1588, 84%, 1020 KB, SSIM 0.973463 × 3497, 76%, 1002 KB, SSIM 0.92

The default): picture size, quality, file size and SSIM.

Every one of the 24 measured targets fit. Where quality alone missed or went very low, the result also scored higher: SSIM rose by 0.01 to 0.36.

What SSIM does and does not tell you

SSIM compares the result with the original at the result's own size, so a shrunk picture is compared with a shrunk original. It says the picture is a faithful smaller copy. It does not say a small face is recognizable or a line of text is readable at 306 × 309. A handwritten document at 20 KB was 504 × 209 and scored 0.91, but check it before you send it.

Which target to choose

The right size is the one the destination asks for. If a form says "under 100 KB", use 100 KB or a little under; the tool lands at or below the target, within about 10% for most images. If the destination also states pixel dimensions, shrink to those first with the resize tool and then use this one.

Free tools:Compress an image to 20 KBCompress an image to 50 KBCompress an image to 100 KBCompress an image to 200 KBCompress an image to 500 KBCompress an image to 1 MBCompress an image with a slider

Questions people ask

How do I compress an image to 100 KB?

Choose 100 KB and your image. For our 3.1 MB photo the tool shrank it to 762 × 769 at 76% quality and 96 KB. Quality alone could not reach it.

Why does the picture get smaller in pixels?

Because quality alone could not reach the target without going below 50%. The tool shrinks the picture only then, and shows the new size. Untick the option to keep the dimensions.

Will the result be exactly the target size?

No encoder can promise an exact byte count. The tool stays at or under the target and within about 10% of it where it can.

What is the smallest target?

The tool accepts 5 KB and up. At very small targets the picture becomes very small too.

Does it keep PNG transparency?

No. The output is a JPEG, so transparent areas become white.

Why is KB 1,024 bytes here?

The existing controls use 1,024 bytes per KB. A 100 KB target is 102,400 bytes.

How long does it take?

0.1 to 1.7 seconds in our tests, longest for a 29 megapixel image.

Is my image uploaded?

No. It stays in your browser.

Related

Sources and how we checked

  1. MDN: HTMLCanvasElement.toBlob() (read 2026-10-09)
  2. MDN: CanvasRenderingContext2D.imageSmoothingQuality (read 2026-10-09)
  3. Wikimedia Commons: NASA, Portrait of Neil Armstrong (public domain); the other test images are NASA public domain files and the Bliss copy of the Gettysburg Address (read 2026-10-09)

Reviewed October 9, 2026. The measurements ran the tool's own code in headless Chromium with the browser's canvas JPEG encoder. The script and the results are in data/seo/hub/evidence/2026-10-09/image.