Compress image to a target KB size
Fit photos under an upload limit.
Your inputs
Your results
Ready when you areYour results will appear here.
How it works
Find a downloadable image at or below your target size. The tool measures actual browser-encoded bytes, searches JPEG or WebP quality settings, and reduces dimensions if the minimum quality is still too large. A generated sample lets you try the real compression workflow before choosing a file. Browser API reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob.
Read the source reference ↗A few things to know
Results vary with the browser encoder. Quality percentages are settings, not perceptual scores; the search approximates the highest fitting quality. JPEG removes transparency with a white background. Both formats can lose detail; metadata is not preserved, and animated inputs yield one frame. Source files are limited to 25 MB, 16 million pixels, and 8,192 pixels per side. The maximum output dimension is 4,096 pixels. This tool does not upload images.
When to use this tool
An upload form may require an image below a specific file size, while a website may benefit from lighter image downloads. This compressor searches browser encoding settings and, when necessary, reduces dimensions to fit your target. It reports actual output bytes rather than estimating size from a quality percentage. Choose JPEG for a white transparency background or WebP when transparency matters, then inspect the result before using it.
- Prepare a photograph for a form with a kilobyte upload limit.
- Reduce an image’s download size while keeping a chosen maximum dimension.
- Compare JPEG and WebP output before adding an image to a webpage.
How to use compress image to a target kb size
Choose an image source
Select your uploaded JPEG, PNG or WebP file, or use the generated sample to try compression. Uploaded files must fit the 25 MB, 16-million-pixel and 8,192-pixel-per-side input limits.
Set size and format
Enter Target file size in KB, where one KB means 1,024 bytes. Choose JPEG or WebP and set the maximum width or height. The aspect ratio is retained and the tool does not enlarge the source.
Review the measured output
Generate the image, inspect its reported bytes and dimensions, and look for lost detail. Download the result. If text or faces look degraded, try a larger target, different format or a smaller source crop.
Try a 40 KB sample compression
Inputs
Choose Generate a sample image, target 40 KB, JPEG output and maximum dimension 1,200 pixels. The sample begins at 1,200 × 800 pixels.
Result
In the verified browser run, the output was 40,231 bytes, displayed as 39.29 KB, below the 40,960-byte target. Exact bytes and selected encoder settings can vary between browsers.
What it means
The target is an upper size limit, not a requirement to hit exactly 40 KB. Judge the downloaded image’s appearance alongside its measured bytes; encoder quality is not a perceptual score.
Common mistakes to avoid
Losing transparency unexpectedly
JPEG has no transparency, so transparent areas are flattened onto white. Choose WebP when you need a transparent background and confirm the receiving application accepts it.
Reducing quality without checking dimensions
Very small targets can require a smaller image, not just stronger compression. Review the output width and height when the final use needs readable text or a minimum resolution.
Expecting metadata or animation
Canvas export does not preserve the source metadata, and animated inputs become one frame. Keep the original when animation or original metadata is part of your workflow.
Frequently asked questions
Definitions, edge cases, and practical next steps for this tool. Search all tool FAQs ↗
How does compression reach the target file size?
The tool encodes trial images and measures their actual bytes. It searches quality settings and reduces dimensions if minimum quality is still too large. The search approximates the highest fitting setting; it does not mathematically guarantee the best possible image for that budget.
Does 100 KB mean 100,000 bytes?
Here, 100 KB means 102,400 bytes because the tool uses 1 KB = 1,024 bytes. Some upload forms use a different convention. Compare the output’s actual byte count with the receiving service’s limit and leave room when its definition is unclear.
Which formats can I upload and download?
You can upload JPEG, PNG or WebP within the input limits. Output is JPEG or WebP. PNG can be used as a source, but this tool does not export lossless PNG or animated image sequences. Choose a format supported by your destination.
Will the tool change my image’s aspect ratio?
It retains the source aspect ratio while applying the maximum dimension and any further size reduction. It never enlarges the source. A maximum of 1,200 pixels therefore means the larger side is at most 1,200, not that both sides become 1,200.
Why do results differ between browsers?
The browser provides the image encoder, and its output can differ with browser implementation and version. Quality settings are encoder controls rather than standardized visual grades. Use the reported bytes and inspect the actual downloaded image instead of comparing percentages alone.
Can compression improve an already blurry image?
No. It reduces size and may remove additional detail; it cannot recover missing resolution. Start with a suitable original and keep a backup. If the target is too restrictive for the needed quality, change the crop, dimensions or upload requirement where possible.
Are my uploaded images sent to a server?
The compression workflow runs locally in your browser and does not upload the source image. The generated sample also uses local processing. Downloading produces a local output file, which you can then choose to upload elsewhere yourself.
Why is a large image rejected before compression?
The input limits protect browser memory and processing time. A small compressed source file can still decode into a huge pixel buffer. Use an image editor to reduce oversized dimensions first if the source exceeds 16 million pixels or 8,192 pixels on one side.
Explore the topic in the blog
Sources and method
Use the references below to check definitions and platform guidance. The model’s scope and limits are explained above. Read our editorial standards.