Compress images to a target size

Compress images to 100 KB, 200 KB, 500 KB or a custom size, individually or in batches.

  • Runs locally
  • Free

Use the tool

Your files are processed in your browser and are not uploaded to a server.

About this tool

Compress images to 100 KB, 200 KB, 500 KB or any custom size to meet upload limits on application, exam and government sites. The tool encodes each image and checks the real byte count, optionally scaling dimensions, without your photos leaving the device.

Typical uses

  • An application photo must be under 200 KB
  • A store backend limits product image size
  • Email attachments are too large and need batch compression

How to use

  1. Choose images and a 100, 200, 500 KB or custom limit, or switch to manual quality.

  2. Optionally allow resizing, process and inspect actual bytes, dimensions and target status before downloading.

Example

If a form allows no more than 200 KB per image, choose 200 KB and allow resizing if needed. Inspect the actual byte size and target status before downloading.

Good to know

1 KB = 1024 bytes. Target mode keeps quality at 50% or more where possible and reduces dimensions if allowed; without resizing only quality changes and a target may be unreachable. PNG has no lossy quality setting; JPG fills transparency white. Up to 50 images/100 MB input and 128 MB output.

KB means 1024 bytes. Compression can reduce quality or dimensions. Targets may be unreachable without resizing; PNG does not use lossy quality settings and JPG fills transparency white.

How the tool finds a size that fits

In “Target file size” mode the tool never estimates the file size from a formula. It actually encodes the image and checks the byte count each time. 1 KB is 1024 bytes and the limit is a ceiling, so 200 KB means at most 204,800 bytes. Each image goes through these steps:

“Size limit per image” offers 100, 200 and 500 KB; choose Custom and enter any number from 1 to 102400 in “Custom limit (KB)”. Decimals are allowed and the byte limit is rounded down, so 19.5 KB is 19,968 bytes.

  1. Encode once at the original pixel size and quality 95%. If that already fits, it is used: 1 encode.
  2. With “Reduce dimensions when needed to meet the target (keep aspect ratio)” ticked (the default), encode at the preferred quality, 50%, at the current size. If that fits, run a 7-step binary search between 50% and 95% and keep the highest quality that fits; the precision is about 0.35 percentage points.
  3. If 50% is still too big, width and height are multiplied by √(limit ÷ size at 50%) × 0.95, clamped to 0.05–0.95 and rounded down. The image is redrawn from the original, never from a compressed copy, and step 2 is repeated at the new size; 95% is not tried again. There are at most 8 shrinks.
  4. Only if 50% still does not fit after the last shrink (very small targets) does the search drop to the minimum, 10%, at that last size and bisect between 10% and 50%.
  5. With resizing off the pixel size never changes: 95% is followed by 10%, and if that fits, a 7-step search between 10% and 95% (precision about 0.66 points).
  6. PNG has no quality setting, so each pass is a single encode. If the file is too big and resizing is allowed, it is shrunk with the same formula, using the PNG size, up to 12 times.
  7. If nothing fits, you get the smallest file produced along the way, marked “not met” in the results.
CaseEncodes
Fits at quality 95%1
Fits at 50% at the original size9
Fits at 50% after one shrink10
Fits at 50% after three shrinks12
50% never fits, 10% does18
JPG / WebP never fits (resizing on)11
Resizing off, fits by lowering quality9
Resizing off, even 10% is too big2
PNGup to 13
If the original is already under the limit

Step 1 still re-encodes it at 95% quality. The result stays under the limit but if the original was saved at a lower quality, the result can be larger than the original. “Compare” shows the percentage change. If the original already fits, just upload the original.

Measured: one 12-megapixel photo, several targets

These figures come from running the tool’s own search function, compressToTarget. The test image is a 4032 × 3024 landscape generated from a fixed random seed (layered noise texture plus the hard edges of a house and a fence). The encoder is Skia through @napi-rs/canvas (Chrome’s canvas is also built on Skia), drawing the image the same way the tool does: white fill for JPG, high-quality smoothing, quality rounded to a whole percent. Browser encoders produce slightly different byte counts, and real photos vary much more, but the search follows the same path.

LimitFormatEncodesOutput pixelsQuality shownFile sizeMet
1024 KB (1 MB)JPG94032 × 302464%1,022.3 KByes
500 KBJPG112631 × 197352%495.6 KByes
200 KBJPG121358 × 101856%197.4 KByes
100 KBJPG11949 × 71254%99.2 KByes
50 KBJPG11654 × 49155%49.6 KByes
20 KBJPG11414 × 31053%19.7 KByes
500 KBJPG (resizing off)94032 × 302420%484.9 KByes
200 KBJPG (resizing off)24032 × 302410%286.8 KBno
200 KBWebP121683 × 126351%195.6 KByes
100 KBWebP13898 × 67355%99.4 KByes
  • At 1 MB the full-size photo fitted at 50%, so the pixels were kept and the search raised the quality to 64% (9 encodes).
  • From 500 KB down, 50% at full size was too big, so the photo was shrunk 2–4 times and the quality then raised again. Every resized result ended between 51% and 56%. At 500 KB that is 2631 × 1973, 43% of the original pixels.
  • With resizing off the pixel size is kept and only the quality drops: at 500 KB to 20% (484.9 KB). At 200 KB even 10% leaves 286.8 KB, so after 2 encodes the tool returns that file marked as not met.
  • “Quality shown” is the rounded whole number in the result list; the search itself works with fractional values.

How the 100 KB row got there: at 50% the full-size file is 848.7 KB, about 8.5 times the limit, so the sides are scaled by 0.326. At 1314 × 986 it is still 173.0 KB; a second shrink by 0.722 gives 949 × 712, which fits at 50%. The last 7 encodes raise the quality as far as the limit allows.

All 11 encodes of the 100 KB (102,400 bytes) row
#PixelsQualitySizeFits
14032 × 302495.0%2,838.7 KBno
24032 × 302450.0%848.7 KBno
31314 × 98650.0%173.0 KBno
4949 × 71250.0%93.7 KByes
5949 × 71272.5%142.1 KBno
6949 × 71261.3%111.5 KBno
7949 × 71255.6%102.3 KBno
8949 × 71252.8%98.1 KByes
9949 × 71254.2%99.2 KByes
10949 × 71254.9%100.6 KBno
11949 × 71254.6%100.6 KBno
Same photo, JPG with resizing on: the previous search and the current one
LimitBefore: pixelsBefore: qualityNow: pixelsNow: quality
500 KB4032 × 302420%2631 × 197352%
200 KB3024 × 226810%1358 × 101856%
100 KB1606 × 120415%949 × 71254%
50 KB1136 × 85214%654 × 49155%
20 KB718 × 53815%414 × 31053%

The previous search shrank the image based on its size at 10% quality, so after a resize it nearly always ended between 10% and 17%. The current one spends the same bytes on fewer pixels at a much higher quality: every row now has fewer pixels than before, without the blocking.

How much it shrinks when quality is not enough

The shrink factor depends only on how many times larger than the limit the file at 50% is (for PNG, the PNG file). Bytes fall roughly in proportion to the pixel count, so the side scale is √(limit ÷ size) with a 0.95 margin, clamped to 0.05–0.95. A small overshoot costs only a few percent per side:

File at 50% ÷ limitSide scalePixels kept
1.05 ×0.92786.0%
1.50 ×0.77660.2%
2.00 ×0.67245.1%
4.00 ×0.47522.6%
10.00 ×0.3009.0%
100.00 ×0.0950.9%
1,000.00 ×0.0500.3%
  • PNG: the 1600 × 1200 version of the photo above is 3,508.0 KB as PNG, with a 500 KB target. The first shrink reaches 573 × 430 at 595.0 KB, 19% too big; the second scales by 0.871 to 499 × 374 and 457.7 KB, keeping 76% of the previous step’s pixels. The previous rule cut every side by at least 25%: 543 × 407 was only 7% too big and still went to 407 × 305, losing 44% of its pixels.
  • For JPG and WebP the quality stays at 50% or above while the image is shrunk, and is then raised as far as the limit allows: 51%–56% in the measurements, instead of the 10%–17% of the previous version, where JPEG blocking and colour banding were visible. The price is fewer pixels.
  • If the pixel size must stay, untick “Reduce dimensions when needed to meet the target (keep aspect ratio)”. The quality can then fall as far as 10%: at 500 KB this photo kept 4032 × 3024 at 20%, and at 200 KB even 10% was 286.8 KB, so the result was marked “not met”.
  • If you need particular dimensions, resize first with the batch resizer and then compress. Resizing to 2048 × 1536 first changes little for a 200 KB target: that size is still too big at 50%, and the tool shrank it to 1398 × 1048 at 55% (198.0 KB), close to the 1358 × 1018 at 56% it reaches from the original. Choosing a size smaller than the tool would leaves more room for quality.

Output format and the result file

  • JPG is the default, and transparent areas are filled with white. WebP and PNG keep transparency. If the browser cannot export WebP, the option reads “WebP (export unavailable)” and cannot be chosen.
  • PNG is lossless and has no quality to lower, so each round is a single encode and only shrinking reduces the size. To get a photo down to a few hundred KB, JPG or WebP keeps far more pixels.
  • “Manual quality” mode encodes once at the slider value (80% by default, 10%–100% in 5% steps). It does not check the size and never resizes.
  • Results are re-encoded from a canvas, so EXIF data such as GPS location is not kept. Names get a -compressed suffix, and duplicates get “ (2)” and so on.
  • When an image arrives directly from another tool such as the ID photo background changer, resizing is off by default so the pixel size required by a form is not changed; if the target cannot be met it is reported as not met.

Messages and what to do

MessageCauseWhat to do
Enter a target between 1 and 102400 KB.The custom limit is empty, not a number, below 1 or above 102400.Enter a number from 1 to 102400; decimals such as 19.5 are allowed.
Target 200.0 KB · not met, and “2 did not meet the size target.” in the summaryResizing is not allowed and even 10% at the original size is over the limit. With resizing on, this only happens with very small targets that still do not fit after 8 shrinks (12 for PNG).Tick “Reduce dimensions when needed to meet the target (keep aspect ratio)”. If the pixels must stay, use JPG/WebP or crop away empty background first.
Source images are limited to 45 MP and 16384 px per side.The original is over 45 MP or 16384 px on a side, e.g. 8064 × 6048 (about 48.8 MP).Shrink it with the batch resizer first.
Only PNG, JPG and WebP images are supported.The selection contains HEIC, GIF, BMP, AVIF or another format. One unsupported file rejects the whole selection.Convert HEIC to JPG first; remove unsupported files and select again.
Use up to 50 images totaling at most 100 MB.More than 50 images or more than 100 MB at once.Split the batch.
Results reached the 128 MB limit. Reduce dimensions or quality.Results total more than 128 MB.Finished results are kept; download them, then use “Retry failed” or continue with the rest.
This browser cannot export the selected format. Use PNG or JPG.The browser cannot export the chosen format (usually WebP).Choose JPG or PNG.

Related guide

  • ID and passport photo sizes — A chart of common ID, passport and visa photo sizes in millimetres, inches and pixels, with digital file limits, background colours and how to print photos at home at the right size.
  • Image and PDF compression guide — Why photos are several MB, whether to resize or lower quality first, and measured JPG sizes at different pixel sizes and qualities — plus roughly how many pixels fit in 20 KB, 100 KB or 500 KB, why PNG won’t shrink, and how to compress scanned PDFs.

Frequently asked questions

Why can’t it reach my target size?

Quality alone has a floor. Allow resizing and the tool scales the image proportionally until it fits; without resizing, some images may not reach the target.

Is 1 KB 1000 or 1024 bytes?

This tool uses 1 KB = 1024 bytes, as most upload systems do, and shows the exact byte count of each result.

Can PNG files be compressed?

PNG has no lossy quality setting, so savings come from resizing. For strict limits, output JPG instead (transparency becomes white).