Compress Image to a Target Size in KB
Compress JPG, PNG, WebP, HEIC, AVIF or TIFF images to a set size such as 50 or 100 KB, or by quality. Lossy PNG, batch and ZIP. Runs in your browser.
How to compress an image to a specific size
- Choose, drop or paste one or more images: JPG, PNG, WebP, HEIC, AVIF, TIFF, GIF, BMP or SVG.
- Pick the output. Same as original keeps JPG as JPG, PNG as PNG and WebP as WebP, and turns HEIC, TIFF and BMP photos into JPG (PNG if they have transparency).
- Type the maximum size in KB, or tap a common limit. The tool finds the best quality that fits. Switch to A quality level to set it yourself.
- Drag across the preview to compare the original (left) with the result (right), then press Download, or Download all as ZIP for a batch.
How the target size is found
JPG, WebP and AVIF are encoded at a quality from 1 to 100%, and the file size depends on the picture: a clear sky compresses far better than foliage or text. There is no formula from kilobytes to quality, so the tool searches: it encodes at 30%, then aims each further try from the sizes seen so far and keeps the highest quality, up to 95%, still under the limit. The result is never made larger than your original when a smaller file is possible. The trial encodes run in a background worker, so the page stays responsive.
If even 30% is too large, the image is scaled down by about the square root of the overshoot, since file size grows roughly with the pixel count. Below about 30%, JPG shows blocky 8×8 artefacts, and a smaller image at a sensible quality usually looks better. Tick Keep the width and height to go as low as 1% instead.
Compressing PNG
PNG is lossless, so re-saving it barely changes its size. The tool makes PNGs smaller the way pngquant and TinyPNG do: it reduces the image to a palette of at most 256 colours, chosen by median cut and refined with k-means, and saves an indexed PNG, which is often less than half the size and keeps transparency. Dithering mixes neighbouring colours to hide banding in gradients, usually for a slightly larger file. Images with 256 colours or fewer, such as most logos and icons, stay pixel-exact. For photos, JPG or WebP keeps far more detail at the same size.
KB means 1,000 bytes here
Windows shows sizes in 1,024-byte units but labels them KB. This tool uses 1,000, the stricter reading, so a file made for a 50 KB limit is at most 50,000 bytes and also passes a checker that allows 51,200.
| Limit | 1 KB = 1,000 bytes | 1 KB = 1,024 bytes |
|---|---|---|
| 20 KB | 20,000 | 20,480 |
| 50 KB | 50,000 | 51,200 |
| 100 KB | 100,000 | 102,400 |
| 1 MB | 1,000,000 | 1,048,576 |
What else changes
- Transparency: JPG has none, so transparent areas become white.
- Metadata: EXIF data, including the GPS location, is removed unless you choose to keep it (JPG and WebP). The rotation a phone recorded is applied to the pixels, so the photo stays upright.
- Colour: wide-gamut photos are converted to sRGB.
- Animation: only the first frame of a GIF or WebP is kept.
Frequently asked questions
Are my images uploaded to a server?
No. Every image is decoded, compressed and saved by your own browser. Nothing leaves your device, and the page keeps working offline once loaded.
How do I compress a PNG and keep it as PNG?
Choose Same as original or PNG. The colours are reduced to a palette of up to 256, which usually cuts the size by more than half and keeps transparency. Lower the colour count, or the target size, for smaller files.
Why did the width and height change?
The target could not be reached even at 30% quality (or 32 colours for PNG), so the image was scaled down until it fits. Tick Keep the width and height to lower the quality instead, raise the limit, or choose WebP.
What quality setting should I use?
For photos, 70 to 85% is hard to tell from the original and much smaller. Below about 40% blocky artefacts appear around edges and in smooth gradients. Use the compare slider to judge.
Is the result exactly the size I typed?
It is the largest quality step that stays at or under your limit, usually within a few percent of it. It never goes over.