# Compress Image to Exact File Size (KB)

> Loft Compress Image to KB is a free online tool that compresses an image to an exact target file size in your browser. A binary search tunes the JPEG quality to land as close as possible under your cap — and if quality alone isn't enough, it auto-downscales the dimensions until the image fits. Useful for exam portals, visa forms, and job applications with strict KB limits. It works on JPEG, PNG, and WebP and outputs JPG or WebP. No upload, no account, no watermark — your photo never leaves your device.


Live tool: https://lofttools.com/tools/image-tools/compress-image-to-kb

Category: Image Tools


## What it does

- Target presets — 20 KB, 50 KB, 100 KB, 200 KB, 500 KB, 1 MB
- Custom KB input for any arbitrary byte cap
- Output formats — JPEG (default), WebP, or AVIF (where the browser can encode)
- Inputs — JPEG, PNG, WebP, GIF, BMP, TIFF, AVIF, and HEIC/HEIF
- Binary-search quality engine (7 iterations → ±5 bytes accuracy)
- Auto-downscale if minimum quality still exceeds target
- Per-file batch queue — queued / running / done / failed per row
- Per-row old→new size, % saved, and applied quality
- Bulk-set format and target across the whole batch without re-uploading
- Manual quality override and preserve-EXIF option (JPEG→JPEG)
- Download each result or grab a single ZIP of the batch
- Browser-only — files never leave your device

## How it works

1. **Upload images** — Drop one or many images (JPEG, PNG, WebP, GIF, BMP, TIFF, AVIF, HEIC), or click to browse. Up to 50 MB per file.
2. **Pick target size** — Select a preset (20 KB / 50 KB / 100 KB / 200 KB / 500 KB / 1 MB) or type a custom KB value.
3. **Choose output format** — Pick JPEG (widest support), WebP, or AVIF (highest quality per byte where the browser can encode it).
4. **Compress and download** — Click Compress. Each file lands at or under the target — download rows individually or as a single ZIP, with old→new size shown per file.

## FAQ

### How does the tool reach an exact KB size?

It runs a binary search across JPEG/WebP quality levels (7 iterations) to find the highest quality whose encoded size stays at or below your target. If even the minimum quality exceeds the cap, the image dimensions are scaled down by 15% per step until the file fits.


### What image formats are accepted?

Inputs include JPEG, PNG, WebP, GIF, BMP, TIFF, AVIF, and HEIC/HEIF (HEIC is decoded automatically). Output is JPEG, WebP, or AVIF — the lossy formats whose quality the binary search can tune. AVIF and WebP appear only when your browser can encode them.


### Will my image be uploaded to a server?

No. All compression runs via the Canvas API in your browser tab. Your photo never leaves your device.


### Can I compress multiple images at once?

Yes. Drop several images and they are all compressed to the same target size. The results are packaged into a single compressed.zip download.


### Why is the actual size slightly below (not exactly at) the target?

The binary search finds the highest quality whose output is at or under the target — it cannot control the encoder to produce exactly N bytes. The result is always at or below the cap, never over.


## Tips

- **Hit strict portal byte caps reliably** — Government portals and exam systems often enforce exact KB limits that standard image editors miss. The binary-search engine finds the highest quality that fits without going over.

- **Let auto-downscale handle extreme cases** — When the target is very small (e.g. 20 KB for a large photo), the tool automatically reduces dimensions until the file fits — no manual resize needed.

- **Batch compress for bulk applications** — Uploading photos for multiple applicants or forms? Drop all images at once and download a ZIP with every photo compressed to the same target size.


## Privacy — what we do not do

This tool runs entirely in the browser via WebAssembly. Your file never reaches a Loft Tools server. Specifically:

- **No upload.** The file bytes load into the browser tab's memory and process on your own CPU. Open DevTools → Network and observe zero outbound requests carrying file data while Compress Image to Exact File Size (KB) runs.
- **No AI training on your file.** Loft does not train models. We could not train on a file we cannot see.
- **No content scanning.** No virus, copyright, or content-moderation pass against your file. The bytes are not accessible to us.
- **No server-side log of file contents, filenames, or EXIF metadata.** Cloudflare edge captures URL and truncated IP for abuse defense (standard CDN behaviour). Cloudflare Web Analytics records anonymous page hits, no cookies, no PII. Nothing about your file content reaches any log.
- **No retention.** Close the tab and the file leaves browser memory. No backups exist on our side because no copy ever existed on our side.
- **No account.** No email, no signup, no auth, no telemetry tied to you.
- **Offline-capable after first visit** (PWA). Once you've loaded a tool, it caches; later sessions work without internet. For high-sensitivity files, run the tool once online to warm the cache, then disconnect before processing.

Compare with upload-based services: each transmits your file to a processing server. Even over HTTPS, each has logs, retention windows, and subpoena exposure. Loft has none of these because the server architecture does not include your file.

## More

- All tools: https://lofttools.com/tools
- Category: https://lofttools.com/tools/image-tools
- LLM index: https://lofttools.com/llms.txt
