Compress to KB
Pick a target size. We binary-search JPEG quality locally. Best-effort — some images cannot hit very small targets without heavy artifacts.
Tips: Compress PNG for email size limits · 100 / 200 / 500 KB attachment caps · about 1 MB · PNG to JPG · government or university form cap · WhatsApp to email size.
Related tools: HEIC to JPG · WebP to JPG · AVIF to JPG · Resize · Remove EXIF.
PNG, JPEG, WebP
Steps
- If the file is still HEIC, convert it on HEIC to JPG first. This page decodes PNG, JPEG, and WebP only.
- Drop the file. The Target KB box starts at 100 and accepts 10 through 5000. Replace 100 with the cap you were given: 200 for 200 KB, 1000 for about 1 MB. Do not type 1 for one megabyte.
- Press Compress. Ten JPEG encodes search quality from 0.10 to 0.95. Width and height do not change. The photo is not uploaded, and ormbg is not downloaded.
- Read the status line. It prints the real size and the target. The download is the last probe, so it can sit a little under or a little over. It is not a stored file that is guaranteed under the cap.
- Download
compressed.jpgand check that size on disk. If quality 0.10 is still over the cap, crop in another editor and run again. If the original was already small enough, keep it. This pass re-encodes anyway. Worked caps: 100, 200, or 500 KB and about 1 MB.
How it works
Compress to KB decodes a PNG, JPEG, or WebP in the browser, then searches JPEG quality. Ten probes run between 0.10 and 0.95. Each encodes the full canvas and compares blob.size / 1024 with the number you typed. The download is the last probe, saved as compressed.jpg from a blob: URL.
Width and height do not change. A 12 megapixel photo can stay well above 100 KB even at quality 0.10, because the page never scales the pixels down. There is no second pass. ormbg is not downloaded. HEIC is not decoded; convert it on HEIC to JPG first. WebP or AVIF that a form will not open should become a JPG on WebP to JPG or AVIF to JPG before you type a tight cap here, if those pages are the clearer first step for the format.
The box is marked 10 through 5000 and starts at 100. The comparison uses blob.size / 1024, the same KB the status line prints. For “about 1 MB”, type 1000 (that guide). Tight email caps are 100, 200, or 500 KB.
A concrete pass: the job portal says “max 200 KB per image.” Type 200. Read the status line, then the size on disk. If it prints about 188 KB, attach that file. If it prints 260 KB at the lowest probe, the pixel grid is too large for that cap — crop locally, then type 200 again. Do not type 80 hoping the page will invent a smaller width. A file that is already 150 KB does not need this pass; re-encoding it only adds artifacts. Skip the tool when the original already fits. A government form that names its own number is JPG under a form cap.
Another pass: a PNG screenshot of a spreadsheet emailed as an attachment. Type 200 if the mailbox or ticket system rejects larger files. Read the preview — fine grid lines often blur at 100 KB even when the status hits the number. Raise to 300 or 500 when the text must stay readable, or crop to the rows that matter and type 200 again. Walkthrough: Compress PNG for email.
What the status line says
Read this line before you attach the file. The numbers are kilobytes from blob.size / 1024, one decimal place. The download is the last of the ten probes, and its name is compressed.jpg. This page has no cancel overlay and no model download.
- Before a file. “Waiting for an image.” Compress stays disabled. The Target KB box already shows 100.
- After you choose a file. “Ready: ” plus the file name. Replace 100 before you press Compress if the form named a different cap.
- While it runs. “Compressing toward ~{kb} KB…” {kb} is the integer in the box. Type 1000 and the line says “Compressing toward ~1000 KB…”. Type 200 and it says “Compressing toward ~200 KB…”.
- When the search finishes. “Done: {sz} KB (target {kb} KB). Best-effort JPEG quality search.” {sz} is the last probe. It can sit under {kb} and it can sit over {kb}. Open the JPEG and check the size on disk before a portal sees it. A file that is already under the cap still gets this line, because the page re-encodes anyway.
- The browser cannot open the file. “Browser could not decode this image.” A HEIC produces that sentence. This page does not load libheif. Convert on HEIC to JPG first, then come back with the JPG.
- The JPEG could not be written. “JPEG encode failed”. There is no
compressed.jpg. The original file is unchanged. - The tab ran out of memory. An out-of-memory failure can read “Not enough memory to decode this HEIC. Try a smaller image or close other tabs.” The sentence says HEIC even on this page, because the error text is shared. The photo was not uploaded. Close other tabs, or crop, then run again.
Limits
- The last probe can sit a little under or a little over. The download is that last encode, not a stored “largest file that is guaranteed under the cap.”
- A floor you cannot beat. If quality 0.10 is still larger than the target, the tool still returns that JPEG and the status shows the real size. Use Resize for a smaller pixel grid, then run again. This page will not invent a smaller width or height.
- Alpha is discarded. A transparent PNG becomes an opaque JPEG. Paint a backdrop first if the form needs white. Do not run a cutout through this page if you still need the transparent PNG. See PNG to JPG.
- JPEG only. There is no PNG or WebP output, and no path back to HEIC.
- Already-small files are re-encoded anyway. Compare the download with the original before you replace a sharp file.
- Text screenshots suffer at 100 KB because the pixel size stays large. See PNG for email.
- HEIC never enters this search. Convert on HEIC to JPG first, then return here if that JPEG is still over the cap.
- No account and no model. Compress does not use the background-removal allowance.
FAQ
Does my photo leave the device?
No. JPEG quality search runs in this tab. The download is a local blob URL. Verify local · 0-byte upload proof.
What target KB should I type?
Use the cap the form named. 100 KB is tight, 200 KB is a common email-screenshot budget, 500 KB keeps more detail. Best-effort — raise it if text blurs. Attachment caps.
Is ormbg involved?
No. This page does not download a background-removal model. ormbg is only used on Remove background.
Why didn't I hit exactly N KB?
Ten probes search JPEG quality between 0.10 and 0.95. The download is the last probe, so the file often lands a little under the number you typed and can land a little over it. Width and height do not change. If quality 0.10 is still too big, crop first or raise the cap. A portal that names its own number is covered in government and university form caps.
Does 100 KB shrink a 4000 px photo to a smaller pixel size?
No. Only JPEG quality changes. If the smallest encode is still over the cap, the status shows that larger size. Use Resize for pixel width and height, then compress again.
What about a PNG screenshot versus a photo?
A PNG screenshot often stays large until it becomes a JPEG. See compress a PNG for email. Photos that are already JPEG can go straight through this page.
The box already says 100. Should I leave it?
Only when the form said 100 KB. Replace 100 with the number you were given. Type 1000 for about 1 MB. The field accepts 10 through 5000. The download is named compressed.jpg.
Sources
- JPEG on jpeg.org — the committee’s own description of the JPEG still-image format this page writes.
- ITU-T T.81 (JPEG specification) — the still-image codec, hosted by the W3C.
- W3C JPEG overview — short pointer to that specification and to the format’s history.
- HTMLCanvasElement.toBlob() on MDN — each of the ten probes is one JPEG encode through this call.
- Blob on MDN —
blob.sizeis the byte count the status compares with the cap, divided by 1024.