Compress Image to Target File Size

Need an image under a specific file size? Set your target — 50KB, 100KB, 200KB, 500KB, 1MB, or anything in between — and Compresso automatically finds the highest quality that fits. Unlike manual quality slider adjustment where you guess and check, target size mode uses a binary search algorithm that converges in seconds, testing multiple quality levels to find the optimal setting. This is the most efficient way to meet strict file size requirements for online forms, applications, and platform-specific limits.

Drop images here or click to upload

PNG, JPG, WebP, HEIC — up to 50MB each

Set any target file size from 10KB to 50MB with precision control

Automatic quality optimization via binary search algorithm

Logarithmic slider gives fine control at smaller target sizes

Per-file feedback showing achieved quality and output size

Batch compress multiple images to the same target simultaneously

Supports JPG, PNG, WebP, and HEIC input formats

Real-time size preview before download

No uploads — everything runs privately in your browser

When You Need an Exact File Size

Many situations require images under a specific file size — and guessing with a quality slider is frustrating and time-consuming. Target size mode solves this by automating the quality selection process.

Common Target Size Requirements

  • 100KB — Passport photos, visa applications, competitive exam registrations, government ID submissions
  • 200KB — Government portals, job applications, university admissions, professional licensing
  • 500KB — Web images, CMS uploads, social media optimization, blog content
  • 1MB — Email attachments, e-commerce product photos, portfolio images
  • Custom sizes — Platform-specific limits, CDN restrictions, API payload limits

The Binary Search Algorithm

Compresso's target size mode uses binary search — the same algorithm used in computer science to efficiently find values in sorted data. Instead of trying every quality level from 100% down to 1% (100 attempts), binary search narrows the range by half each iteration:

  1. Try 50% quality → too big? Go lower. Too small? Go higher.
  2. Try 25% or 75% → narrow the range again
  3. Continue halving until the optimal quality is found

This converges in 6-8 iterations instead of 100, making it nearly instantaneous while always finding the highest quality that fits your target.

Related Tools

Frequently Asked Questions

How does target size compression work?

Compresso uses a binary search algorithm to find the highest image quality that produces a file under your target size. Starting at a mid-range quality, it compresses the image and checks the output size. If it's under the target, it tries higher quality; if over, it tries lower. This process repeats, narrowing the range each iteration, until it converges on the optimal quality — typically in 6-8 steps taking less than a second total.

Can I compress to any file size?

Yes — set any target from as low as 10KB to as high as the original file size. The logarithmic slider gives you fine-grained control at smaller sizes (where each KB matters) while allowing quick selection of larger targets. Common targets include 100KB (passport photos), 200KB (government forms), 500KB (web images), and 1MB (email attachments).

What if my target size is too small?

If even the lowest quality can't reach your target, Compresso will produce the smallest file possible and show you the achieved size. To reach extremely small targets, try: 1) Resizing the image to smaller dimensions first, 2) Converting to JPG format (most efficient for photographs), or 3) Accepting a slightly larger target. Dimensions are usually the biggest factor — a 500×500 image can easily reach 50KB, while a 4000×3000 image may not go below 200KB.

Does target size mode work with PNG files?

Yes! When compressing PNGs to a target size, Compresso can convert to JPG or WebP for efficient lossy compression. PNG is a lossless format that doesn't support quality adjustment in the traditional sense, so format conversion is the most effective approach for hitting specific size targets with PNG input.

How accurate is the target size?

Very accurate. The binary search algorithm typically gets within 1-5% of your target while maximizing quality. The output will always be at or under your target — never over. For a 200KB target, the output is typically 190-200KB, using every available byte for maximum quality.

Can I batch compress to the same target?

Yes — upload multiple images and they'll all be compressed to fit under your target size. Each image is individually optimized, meaning each gets the highest quality possible for its specific content. A simple image might achieve 90% quality at your target, while a complex photo might need 65% — both will be under the same size limit.

What format produces the smallest files?

For photographs: WebP is most efficient (25-35% smaller than JPG at equivalent quality), followed by JPG, then PNG. For simple graphics with few colors: PNG can actually be smaller than JPG. For target size mode, JPG or WebP are almost always the best choices.

Is this tool safe for sensitive documents?

Absolutely. All processing happens entirely in your browser. Your images never leave your device — no server uploads, no cloud storage, no data collection. This makes it safe for passport photos, ID scans, medical images, and any confidential content.

Last updated: March 2026