Compress Image to Exact Size
Pick a target file size — 20KB, 50KB, 100KB, 1MB, or anything in between — and get a downloadable image that hits it precisely. No upload, no server, no sign-up. Everything runs in your browser.
Drop an image here, or
JPG · PNG · WebP · GIF · BMP — up to ~50MP
Why compress an image to an exact file size?
Countless online forms — visa applications, job portals, government exams, scholarship submissions, email attachments — enforce hard file-size limits. Upload a photo that is even one kilobyte over the cap and the form rejects it. The frustration of trial-and-error compression (export, check size, re-export, check again) is what this tool eliminates. You say "50KB", it delivers a JPEG that is 50KB.
The tool does this without uploading your image anywhere. Everything happens in your browser: the image is loaded into memory, drawn to an off-screen canvas, and re-encoded as JPEG at a quality level chosen by a binary search that homes in on your target byte count. Because no bytes leave your device, it is also instant — there is no network round-trip, no queue, no server load.
Common file-size requirements (2026)
| Use case | Typical limit | Notes |
|---|---|---|
| China visa photo | 40–120 KB | 33×48mm, white background |
| India government exam photo | 20–50 KB | Often with signature separate |
| US job portals (LinkedIn, Indeed) | <100 KB recommended | Resume headshot uploads |
| Schengen visa photo | <240 KB | 35×45mm biometric |
| Email-friendly inline image | <200 KB | Renders without download prompt |
| Web hero image | <500 KB | Fast LCP for SEO |
| Social media cover | <1 MB | Platform-specific dimensions |
The quick-preset buttons above cover these common targets. For anything else, type a custom number and unit.
How browser-side compression works
JPEG compression has one main knob: quality, a number between 0.01 (maximum compression, smallest file, worst quality) and 1.0 (minimum compression, largest file, best quality). The relationship between quality and file size is non-linear and image-dependent — you cannot predict the byte size from the quality number alone. So instead of guessing, the tool runs a binary search:
- Try quality 0.5 (the midpoint). Encode the canvas to a JPEG blob.
- If the blob is bigger than the target, the right quality is lower — search the bottom half. If smaller, search the top half.
- Repeat, halving the search range each time.
- After 7–12 iterations, the search converges on a quality that produces a blob within ~2% of the target.
If the target is so small that even quality 0.01 cannot reach it (common for large photos targeting under 30KB), the tool automatically downscales the image dimensions and reruns the search. The result always hits the target — the question is only how much resolution you give up to get there.
JPG vs PNG vs WebP — when to use which
- JPG (JPEG) — Best for photographs and images with many colors. Lossy, but the quality/size tradeoff is the most controllable. This is what the tool outputs.
- PNG — Best for graphics with sharp edges, text, or transparency. Lossless, but files are much larger for photos. If you upload a transparent PNG, the transparency becomes white in the compressed JPEG.
- WebP — Modern format with better compression than JPG, but not accepted by all upload forms (many government portals still require JPG). Use JPG when the destination requires compatibility.
Privacy: why "no upload" matters
Most online image compressors send your photo to a server, process it there, and send it back. That means your image is stored — temporarily or permanently — on someone else's machine. For sensitive documents (passport photos, ID scans, medical images, confidential screenshots) that is a real risk. This tool never transmits your image. The Canvas API runs in your browser's sandbox; closing the tab destroys the data. There is no server log, no cloud storage, no analytics pixel that sees your pixels.
Frequently asked questions
Is my image uploaded to a server?
No. Every step — loading, compressing, resizing, and downloading — runs locally in your browser via the Canvas API and createImageBitmap. Your image data never leaves your device. There is no server, no upload, and no storage.
How does the compressor hit an exact file size?
It runs a binary search over JPEG quality (a number from 0.01 to 1.0). For each quality value, it draws your image to an off-screen canvas and calls toBlob("image/jpeg", quality), then checks the resulting byte size. If the blob is too big, it lowers the quality; if too small, it raises it. Binary search converges on the target in about 7-12 attempts. If even quality 0.01 cannot reach the target, the tool automatically downscale the image dimensions and retries.
What image formats are supported?
You can upload JPG, PNG, WebP, GIF (first frame), and BMP. Output is always JPEG for the size-targeted compression (JPEG gives the most control over file size through the quality parameter). If your PNG has transparency, the transparent pixels become white in the JPEG output — the tool warns you before compressing.
Why is there a 20KB limit for some images?
Very small targets may require resizing the image dimensions (not just lowering JPEG quality). For example, hitting 20KB on a 4000x3000 photo means shrinking it significantly. The tool handles this automatically — it first tries quality alone, then progressively downscales until the target is reachable, and shows you the final dimensions so you know what changed.
What file sizes do visa and job applications require?
Common limits: China visa photos require 40-120KB; many US job portals (LinkedIn, Indeed uploads) accept under 100KB; Indian government exam photos are often 20-50KB; Schengen visa photos are usually under 240KB; email-friendly images are under 200KB. The quick-preset buttons cover the most common targets.
Is there a file size or dimension limit?
There is no hard upload limit because nothing is uploaded. However, very large images (over ~50 megapixels) may be slow to process because the browser allocates memory for the canvas. Most photos from phones and cameras compress in under 2 seconds.
Does compression reduce image quality?
Yes — that is the tradeoff. JPEG is a lossy format: lower quality means more compression artifacts (blurring, color banding) but a smaller file. The tool shows you a before/after preview so you can judge whether the quality loss is acceptable for your use case. For documents and forms, the loss is usually invisible; for professional photography, you may want a higher target.
Can I compress multiple images at once?
The current version compresses one image at a time for precise control. Batch mode is on the roadmap. For now, simply run the tool again for each image — it remembers your last target size.