Image compressor: target size in KB, resize in px or %
Shrink a photo under a size limit in KB and resize it in pixels or percent, as JPEG, WebP or PNG, right in your browser without uploading the file.
How to compress an image under a target size
To make an image lighter, the tool re-encodes it as JPEG or WebP at a lower quality and can shrink its dimensions: halving the width and height divides the pixel count by four. In "Maximum size" mode it finds the highest quality that fits under the limit, such as 200 KB. Everything runs in your browser and no image is uploaded.
Method
Each image is decoded in the browser with the orientation stored in the photo, redrawn on a canvas at the chosen size, then re-encoded with canvas.toBlob. In "Maximum size" mode, quality is found by binary search between 5 and 95: the tool tries 95, then 5, then halves the interval seven times and keeps the highest quality that fits. Seven halvings bring the gap down to 0.9 ÷ 27 ≈ 0.007, less than one quality point, in at most 9 encodes. If quality 5 is still too large, both sides are multiplied by √(target ÷ size) × 0.9 and the search starts again, up to four times.
Example
A 4,000 × 3,000 px photo must stay under 200 KB. In a 1,920 × 1,080 px box with the aspect ratio kept, the factor is min(1,920 ÷ 4,000; 1,080 ÷ 3,000) = 0.36, so the image comes out at 1,440 × 1,080 px: 1,555,200 pixels instead of 12,000,000 (13%). At 50% it would be 2,000 × 1,500 px. The tool counts 1 KB = 1,000 bytes, so 200 KB is 200,000 bytes or 195.3 KiB, and the limit also holds for a site that counts 1,024 bytes per KB.
Limits
- PNG is lossless and has no quality setting: reduce its dimensions or switch to WebP or JPEG.
- JPEG has no transparency: transparent areas turn white.
- Re-encoding starts from the pixels, so EXIF metadata (GPS location, camera, date) is not copied.
- A browser that cannot produce the requested format returns PNG, as the HTML standard requires, and the tool says so. HEIC is not read. Tool limits: 50 MB per file, 8,192 px per side and 40 megapixels of output.
Sources and dates: HTML Standard (WHATWG), serializing bitmaps to a file; HTML Standard (WHATWG), createImageBitmap and imageOrientation; PNG Specification, Third Edition (W3C) (checked on 28/11/2026).
Frequently Asked Questions
How do I get a photo under 200 KB?
Pick "Maximum size", enter 200 KB and choose JPEG or WebP. The tool finds the highest quality that fits under 200,000 bytes in at most 9 encodes and, if quality 5 is not enough, shrinks the dimensions. Scaling a 4,000 px wide photo down to 1,920 px first divides its pixels by 4.3, which leaves room for a higher quality at the same size.
Why doesn't my PNG get smaller?
PNG is lossless, so the quality setting does not apply, and re-encoding a PNG can even produce a larger file. Reduce its dimensions (at 50% it keeps a quarter of its pixels) or convert it to WebP or JPEG. JPEG replaces transparency with white.
How do I resize an image without distorting it?
Tick "Keep aspect ratio": the width and height you enter become a box the image fits inside. A 4,000 × 3,000 px photo in a 1,920 × 1,080 px box comes out at 1,440 × 1,080 px, because the smaller of the two factors (0.36) is used. Untick it to force exact dimensions.
Does compressing remove EXIF data and GPS location?
Yes. The image is redrawn and re-encoded from its pixels only, so the EXIF metadata of the original file (GPS location, camera model, date) is not copied. The photo orientation is applied first, so the image stays the right way up.
Is this tool really free?
Yes, all tools on Kristools are 100% free and accessible without registration.
Is my data protected?
Yes. All processing is performed directly and securely inside your browser. No personal data is sent to our servers.