Compress Image to Specific KB Size
Compress JPG/PNG/WebP to a target file size (50KB, 100KB, 200KB, 500KB, 1MB etc.). Browser-side iterative compression.
Why compress to specific KB?
Many online forms, government portals, and applications require image uploads under specific file size limits - 20 KB, 50 KB, 100 KB, 200 KB, 500 KB are common requirements. Examples: passport photo upload (typically 100-200 KB), exam application photos (20-50 KB), driver's license photos (50-150 KB), university admission portals (often 100 KB), and visa applications (varying limits). Standard image compressors give you a quality slider but don't target a specific file size - you have to guess and retry. This tool uses binary search compression to find the highest quality setting that fits your target size, automatically. If quality alone isn't enough (very large source image), it falls back to dimension scaling to meet the target.
How to use this tool
- Upload your image — Click upload or drag-drop. Supports JPG, PNG, WebP.
- Select target size — Common: 20, 50, 100, 200, 500 KB; 1, 2 MB. Or 'Custom' for any specific number.
- Choose output format — JPEG (default, best compression) or WebP (modern, 25% smaller than JPG).
- Read results — Tool shows: target size, output size achieved (within 2 KB), quality % used, and status (Exact match or Scaled down).
- Download compressed image — Filename includes '-compressed' suffix. Use the downloaded file for your upload requirement.
Binary search compression algorithm
The tool uses iterative binary search to find optimal quality:
- Set quality bounds: lo=0.05, hi=0.98
- Try quality = (lo + hi) / 2 (midpoint)
- Re-encode image at that quality. Check resulting size.
- If size <= target: this quality fits. Save as 'best'. Raise lo (try higher quality next).
- If size > target: too big. Lower hi (try lower quality next).
- Repeat 10 iterations. Best quality found is used.
If quality 5% still produces a file too large (very high-resolution source), fall back to dimension scaling:
- Compute scale factor = sqrt(target / original_size)
- Reduce image dimensions by that factor
- Re-encode at 70% quality - typically meets target
Result: typically within ±2 KB of target. For example, targeting 100 KB usually produces 98-102 KB.
Examples
Common use cases:
- Passport photo (200 KB): 5 MB phone photo → 200 KB JPG at 78% quality. Visually identical at typical viewing.
- UPSC exam application (20 KB): 2 MB photo → 20 KB at lower quality, may need scaling. Small but acceptable for exam form thumbnail.
- Driver's license photo (50 KB): 3 MB phone selfie → 50 KB JPG at 65% quality. Slight quality reduction visible up close.
- Aadhaar / PAN upload (100 KB): 4 MB scan → 100 KB JPG. Document text remains readable.
- Online job portal photo (1 MB): 6 MB phone photo → 1 MB JPG at 92% quality. Visually identical.
Tips & best practices
- Smaller target = lower quality required. For 20 KB, expect noticeable quality reduction
- WebP format gives 25% better compression - try it if the destination accepts WebP
- If you don't have a specific target, use 100 KB - excellent quality and small file size
- For very low targets (under 30 KB), consider also reducing dimensions first (use Image Resizer to make it smaller, then compress)
- Some platforms reject images BELOW a certain size as 'too small' - check requirements both ways
- If your image won't fit under target even at lowest quality + scaling: the source is too large or complex; consider a different image or higher target
- Keep originals - downsized images can't be 'upscaled' back to original quality
Limitations & notes
Browser-side compression may not always hit EXACT target (typically within 2 KB). For very small targets on complex source images, dimension scaling becomes necessary - reducing image resolution. This is generally fine for thumbnail uses but problematic for high-detail print needs. Some image content (especially photos with many gradients) compresses less efficiently than others - results vary.
Frequently Asked Questions
Why does the result vary by 1-2 KB from target?
JPEG compression has discrete quality steps - you can't get exactly any byte count. The algorithm finds the highest quality that fits under target, typically within ±2 KB. Close enough for any upload requirement.
What if my source image is too large?
If quality alone can't reach the target, the tool automatically scales down dimensions and re-encodes. This may reduce sharpness but ensures the target size is met. For best quality at low targets, start with a smaller source.
Should I use JPG or WebP?
JPG: universal compatibility, all platforms accept it. WebP: 25% smaller files for same quality but some old platforms don't support it. Check what your upload platform accepts. JPG is the safe default.
Will quality be visible?
Depends on target and source. 200+ KB targets usually preserve full visual quality. 50-100 KB introduces slight softness (visible on close inspection). Below 50 KB usually shows compression artifacts. Smaller is always lower quality - choose your target carefully.
Can I compress multiple images at once?
Not currently - one at a time. For batch needs, repeat the process. For high-volume professional workflows, desktop tools like Photoshop, XnConvert, or ImageMagick handle batches efficiently.
Is my image uploaded to a server?
No - 100% browser-side using HTML5 Canvas API. Your image never leaves your device. We have zero access to your files.
What's the smallest I can compress to?
Practically: 5-10 KB for any image with content. Below that, even single-color thumbnails struggle. The tool will reach as close to your target as possible while preserving the image. Targets under 20 KB typically need dimension scaling.
