Skip to content
All Tools

Compress JPG · PNG · WebP 100% local

Target File Size Compressor

Compress an image to a target size such as 100 KB, 200 KB, 500 KB or 1 MB.

Runs in your browser — your image never leaves your device Updated September 2026

Processed directly in your browser. Your image never leaves your device.

About this tool

Compressing to a target file size is the image task most skills do by hand and hindsight: guess a quality number, compress, measure, adjust, repeat. The Target File Size Compressor removes the guessing by inverting the question. Instead of asking what quality you want, it asks what size you want - 100 KB, 200 KB, 500 KB or 1 MB - and then systematically searches for the quality value that produces that size.

The tool exists because the real world imposes real byte budgets. An online form rejects uploads above 200 KB. A seller platform caps product photos at 1 MB. An email gateway bounces attachments over a limit that a co-worker keeps forwarding. In every case the goal is a number, and achieving a number by slider-dragging is inefficient. Setting the budget directly and letting the tool converge on it turns a fiddly manual loop into a single action.

Mechanically, the tool runs a search rather than a single pass. It compresses the image at a quality guess, measures the bytes that came back, and compares the result with the target. If the file is too large, it lowers quality and tries again; if it is too small, it raises quality and tries again, narrowing the range with each attempt until the output lands close to the number you set. Because all of this happens inside browser memory, the process is immediate and private.

The tool accepts JPG, PNG and WebP sources and is most decisive with JPG and WebP, whose lossy encoders can step quality down continuously toward almost any target. PNG is lossless, so the loop applies structural optimizations and then faces the format's hard floor - a clean PNG may simply be larger than a tiny target, which is why the practical answer for very tight targets is usually a WebP output. A reasonable guarantee, not a mathematical one: the result approaches the target closely but is rarely byte-perfect, because the exact size depends on the content.

As with every tool in the suite, processing is strictly local - the image never leaves the device, the limit is roughly 25 MB per input, and the original file is never modified; the compressed result is always a separate download. Before using the tool as a production shortcut, it is worth understanding what it cannot do: it changes quality, not dimensions, so a target below what even a well-encoded image of those pixels can reach will ask for either a resize first or a WebP output instead.

How to use Target File Size Compressor

  1. Open the Target File Size Compressor and select your image (JPG, PNG or WebP).

  2. Choose your target file size from the presets or enter a custom value.

  3. Let the tool run its quality loop - it will compress, measure, adjust, and repeat until the output is close to your target.

  4. Download the result when the quality estimate stabilizes.

What this tool does

  • Choose a target file size.

  • Auto-tunes quality to approach the target.

  • Reasonable guarantees: exact size depends on image content.

Specifications

Input formats JPG, PNG, WebP
Output format(s) Same format as the input
Processing Local browser (Canvas API)
Uploads None — files stay on your device
Max file size 25 MB per file
Original file Never modified
Target sizes Custom value in KB or MB
Algorithm Iterative quality loop with convergence

In-depth Guide

Inside the quality loop

The loop is a form of binary search over the 1-100 quality scale. The tool begins near the middle, encodes the image, and measures the result. A file over the target tells it the answer is below the current quality; a file under the target tells it the answer is above. Each iteration halves the remaining range, so it converges in a handful of steps rather than scanning all one hundred values.

This explains two behaviors users sometimes notice. First, the process takes a moment because several encodings actually happen before the download is ready. Second, the tool stops when a pass lands acceptably close to the target - it does not chase the final byte, because lossy encoding granularity means one more iteration can overshoot in the other direction. The quality value shown with the result is the answer that satisfied the loop, and it is usually the best integer value the format can offer for that image at that size.

How the loop behaves for each input format

The format of the source file changes what the loop actually has to work with. A JPG can be re-encoded at almost any quality, which gives the search a long runway between a tiny file and a large one. A WebP behaves similarly but encodes more efficiently at a given quality, so it usually reaches the same target with a higher quality number - the same target, less visible damage.

A PNG is the wildcard. Because PNG is lossless, the loop first strips metadata and structure, then discovers how big the pixels alone are. If that floor sits below your target, the tool can raise quality only within the lossless range, and the honest outcome is a file at the PNG's natural size - which is why the escape hatch is converting to lossy WebP when the target is aggressive.

Input Primary lever Convergence Tight targets
JPG Quality re-encode Smooth Good - lands close to target
PNG Metadata and structure only Hits the lossless floor early Thin - may cap above the target
WebP Lossy quality on a modern codec Smooth and efficient Excellent - best quality per byte

Choosing a target that matches the job

The right target is a property of the destination, not of the image. A page thumbnail has different needs than an email attachment or a marketplace listing, and each pipeline enforces its own number. Choosing a target a little below the actual limit buys headroom for the moments an image lands slightly over, and choosing one far below the limit trades visible quality for space nobody asked to save.

The same source image behaves differently at each budget. At a loose target the loop returns a high quality value and the file looks untouched. At an aggressive target the quality value falls far enough that photographic texture, gradients and fine edges begin to show. Comparing two or three targets on one image before committing a batch is cheap, and it protects against committing a batch at a number nobody actually needs.

Target Typical use What to expect on a camera photo
100 KB Avatars, thumbnails, tiny embeds Noticeably compressed; fine on small displays
200 KB Blog images, inline emails Good balance on most photos
500 KB Product listings, gallery photos Strong quality; usually below the cap
1 MB Large hero images, print previews Near-original quality at moderate dimensions
Custom Exact pipeline requirement Set just under the real limit for headroom

Resizing first for extreme targets

Every byte budget has a question underneath it: how many pixels do you actually need? A 100 KB budget for an 800 x 600 display is a reasonable ask, but the same budget for a 6000 x 4000 camera original is a demand that quality alone cannot serve. Because the loop operates on quality only, it will reach the target eventually - but the quality it has to use will be low and the artifacts will show.

The professional sequence handles this up front. Resize the image to the dimensions the destination uses, then let the loop find the quality that meets the target at those dimensions. A 1600-pixel-wide photo resized first will meet a 500 KB target at a noticeably higher quality than a 6000-pixel-wide original ever could, and the loop stops being a torture device and becomes a finishing step.

  • Resize to the display dimensions first, then target the byte budget.
  • Let the tool's quality value for a medium target guide whether you truly need dimensions that large.
  • When a target fails repeatedly on large images, the bottleneck is pixels, not quality.
  • WebP output on a resized image delivers the smallest file at the highest visible quality of any combination.

An example run, iteration by iteration

A concrete run makes the loop legible. Consider a 4 MB camera photo aimed at a 500 KB target. The first pass tries a mid-range quality, and the encoder returns a file larger than the target, so the search moves quality down. Each subsequent pass halves the distance, closing in until a pass lands at or below the budget with a quality value the image can tolerate.

The exact trajectory depends on content, but the shape is always the same: a few wide swings early, then tight corrections, then a stop. Watching the reported quality converge is a quick way to learn what a given image can offer - a photo that converges at quality 78 is a different deliverable than one that can only reach the target at quality 50.

Iteration Quality tried Result vs target Next action
1 80 Above target Move quality down
2 60 Below target Move quality up
3 70 Above target, close Refine downward
4 65 At or near target Stop, return quality 65

Common mistakes to avoid

The first mistake is treating the reported size as a hard contract. Lossy encoders work in blocks and entropy, so the output lands near the target but not on it - plan for a small tolerance rather than an exact byte value. The second is aiming far below a sensible floor and then blaming the tool for the softness; a 90 KB target on a full-resolution photo will compress until it looks bad, because there is no quality level that both fits and looks good.

The third mistake is re-running the loop on a file the loop already produced. The downloaded result is already a compressed generation; looping it again stacks loss on top of loss. Run the tool on the untouched original each time, and when a target is simply too small for the pixel data, resize before you compress rather than compressing twice.

  • Do not expect byte-exact sizes on lossy output - allow a small margin.
  • Do not compress the compressed result to chase a smaller number.
  • Do not choose a target without checking the destination really needs it.
  • Do not skip the resize step when the image is far larger than the display it feeds.
  • Do check the reported quality value before a batch - it tells you exactly how much the target costs visually.

How it works

Iterative quality loop

The tool starts at a mid-range quality, compresses the image, measures the output size, and then adjusts quality up or down. This binary-search-style loop repeats until the result converges near your target.

Content-dependent results

A complex photograph contains more information than a simple graphic. Two images compressed to the same quality will not produce the same file size - the tool compensates by tuning quality differently for each image.

Size approximation

JPEG and WebP compression is lossy and content-dependent, so achieving an exact byte count is not always possible. The tool gets close, typically within 5-15% of your target.

Example result

Before After
File size: 4.1 MB File size: 198 KB
Dimensions: 3840 x 2160 px Dimensions: 3840 x 2160 px
Format: JPG Format: JPG

These are illustrative numbers. Your actual result depends on image complexity and the target you choose.

Pro tips

Set targets just under the limit

If a pipeline allows 1 MB, target 950 KB. The loop lands near but not on the number, and the margin keeps a content-heavy outlier from accidentally tripping the cap.

Let the final quality value guide you

The reported quality does the diagnostics for you. Converging above 65 means the target is comfortable; settling near 40 means the image needs a resize before it can meet its budget gracefully.

Prefer WebP for tight budgets

At identical sizes, WebP preserves more visual quality than JPG. When the target would drag a JPG below its comfort zone, the same target on a WebP output often looks clean.

Resize before you chase a number

The loop tunes quality only. For a 200 KB budget feeding a 1200 px grid, scale to 1200 px first and let the loop finish the job at a quality value you will actually like.

Compare two targets before committing a batch

Compress one representative image at the target and at one step looser. If the looser result is visibly identical in your real layout, adopt the looser standard for the whole folder.

Keep the untouched original

Every run starts from the source file you load. Preserve it, because the next iteration, the next target, or the next generation of the pipeline will always benefit from a virgin master.

When to use it

Great for Target File Size Compressor

  • Fit product photos under a marketplace upload limit (for example, Amazon requires images under 10 MB).
  • Shrink email attachments to stay under a 2 MB or 5 MB attachment limit.
  • Prepare images for web forms that reject uploads above a specific size.
  • Batch-optimize a collection of images to a uniform file size for consistent page weight.

Watch out for

  • Very low targets (under 30 KB for a full-size photo) will produce heavily degraded output - the quality loop has to discard a lot of data to fit.
  • This tool compresses by quality only; it does not resize pixel dimensions. Pair it with a resize tool if you also need to shrink the image itself.
  • Exact byte-perfect output is not guaranteed. If you need a precise file size (for example, exactly 100.0 KB), you may need to adjust the target slightly.

Privacy

This tool runs entirely in your browser using the Canvas API. Your image is never transmitted — there is no upload endpoint involved. Clearing the page removes the file from memory.

Edits never overwrite your original file. Every result is a new download, so you always keep the source image. Read the privacy policy.

Troubleshooting

Lossy compression works in blocks and the encoder cannot create fractional blocks. The tool converges as close as possible but small deviations are normal.

Your target is too small for the image content. Try a larger target or reduce the image dimensions first.

Typically 3-10 iterations, each taking a fraction of a second. Complex images at very small targets may need a few more passes.

Frequently asked questions

It will be close. Exact byte counts depend on image content, but the quality is tuned to approach the target.

The tool will output the image at maximum quality without re-encoding beyond what is necessary. You cannot make a file larger than its natural compressed size.

No. Only the compression quality is adjusted. Pixel dimensions stay the same throughout the process.

Yes, but PNG is a lossless format so the tool will apply structural optimizations and metadata stripping. For very tight size targets it may suggest converting to WebP.

Close, but not exact. Lossy encoding works in blocks and its output depends on content entropy, so the tool converges as near as the format allows - typically within a small percentage - rather than promising byte-perfect output.

No. Quality is the only lever the loop moves, so pixel dimensions stay constant. If the target demands dimensions rather than just quality, resize the image before running the tool.

It depends on the source. A flat-color illustration can reach 30-50 KB without suffering, while a detailed photo usually starts looking rough below 100-150 KB at large dimensions. Resizing first is the honest way to reach very small budgets.

The tool cannot usefully grow a file that is already smaller, so it outputs the image at maximum quality. The result is essentially the source re-encoded, and no extra size is invented.

Complex content compresses to larger files at any given quality. To land on the same byte budget, the loop must lower quality further for busy images and can afford higher quality for simple ones - the difference is content, not randomness.

Not on the downloaded result. Each run re-encodes whatever source you give it, so feeding it a previously compressed output compounds quality loss. Always run from the untouched original, and the result stays one generation old at most.

Tool last updated: September 2026. Browse all image tools.