Skip to content

Compress Image to Exact Size

Compress a JPG, PNG or WebP to an exact file size, 20 KB, 50 KB, 100 KB or any target you set. Hits the number, and handles minimum sizes too.

Private · on device. Runs in your browser: your file is not uploaded. No sign-up.

JPG, PNG, WebP, HEIC (iPhone), GIF, BMP or AVIF. Choose several to compress them all.

Why file size limits are so hard to hit

Almost every upload form states its limit in kilobytes, and almost every image tool gives you a quality percentage. Those two things are not the same, and there is no fixed relationship between them. A photo of a plain wall at 60% quality might be 30 KB; a photo of a forest at the same 60% might be 400 KB. Quality controls how much detail the encoder throws away, not how many bytes come out the other end.

That is why the usual routine is so frustrating: export, check the size, it is too big, drag the slider down, export again, now it is 8 KB and unrecognisable, drag it back up, and so on. You are performing a manual binary search, badly.

This tool does that search properly. It encodes your image repeatedly at different settings, measures the actual bytes each time, and converges on the highest quality that still fits your limit. The result is not just under the target, it is close to it, which is exactly what you want, because every unused kilobyte is detail you gave away for nothing.

The minimum-size trap

Almost nobody expects this one. A number of official portals reject files for being too small, on the reasoning that a tiny file means a poor scan:

  • US online passport renewal refuses anything under 54 KB.
  • China's COVA visa system requires 40–120 KB, a window, not a ceiling.
  • Indian recruitment boards (SSC, IBPS, RRB) typically want photos at 20–50 KB and signatures at 10–20 KB.

If you have been compressing as hard as possible to be safe, you may have been failing for the opposite reason to the one you assumed. Set a minimum size in the tool above and the output will land inside the window.

When an image is small and simple enough that it compresses below the floor even at maximum quality, we close the gap by adding a metadata comment block to the file. Every decoder skips those blocks, so the picture is byte-for-byte unchanged, the container just becomes the size the portal expects.

Crop and resize before you compress

This is the single biggest improvement available, and most people skip it. Compression works by discarding detail, so the more pixels you ask it to fit into a fixed budget, the more it has to discard from each one.

Starting imageTargetResult
4000 × 3000 px photo20 KBHeavy blocking, face barely recognisable
Same photo resized to 600 × 450 px20 KBClean and sharp at the size it will be viewed

Set a longest side in the options above, or use the resize tool first if you need exact dimensions. For a photo that will be displayed in a small box on a government form, anything beyond about 800 px is wasted.

Choosing a format

The format matters more than most compression settings, because JPEG and PNG solve fundamentally different problems.

  • JPEG, use for photographs and anything with people or natural scenes. It has a quality dial, so it can be tuned to hit a target. Almost every official portal expects JPEG.
  • PNG, lossless, so there is no quality dial and the only way to shrink it is to reduce dimensions. Correct for screenshots, logos, line drawings and anything needing transparency; a poor choice for a passport photo with a tight size limit.
  • WebP, noticeably smaller than JPEG at the same visual quality, and excellent for websites. Do not use it for official uploads; most portals will not accept it.

If a form says "JPG only" and your file came off an iPhone, it is probably HEIC rather than JPEG even if it looks like a photo. Use the format converter to check and convert.

What compression removes besides detail

Because the image is redrawn from its pixels, the output carries no EXIF metadata. In practice that means the GPS coordinates, camera model, and timestamp embedded by your phone are all dropped. For anything you are sending to a third party, that is a privacy improvement rather than a loss, a photo taken at home usually has your home address written into it.

The one piece of metadata we deliberately write back is print resolution (DPI), and only when a spec calls for it, because a photo sized in millimetres is meaningless without it.

A practical routine

  1. Find the exact requirement, dimensions, format, and both size limits if there are two.
  2. Crop to the required shape first, so nothing important is lost later.
  3. Resize to the required pixel dimensions, or cap the longest side if none are specified.
  4. Compress to just under the maximum, with the minimum set if the portal has one.
  5. Check the downloaded file before uploading, the size is shown in your file manager.

If your requirement is a common one, the requirements database already has the exact numbers and will apply all of them in a single step.

Frequently asked questions

How does this hit an exact file size when other tools only have a quality slider?

File size is not a simple function of quality, so a slider can only guess. This tool encodes your image several times at different settings and searches for the largest file that still fits under your limit, usually landing within a few percent of the target rather than far below it.

Why would a form reject a file for being too small?

Some portals set a minimum as well as a maximum, because a very small file usually means a low-quality scan. US online passport renewal rejects anything under 54 KB, and China's COVA visa system wants 40–120 KB. Set a minimum size here and the file will be brought up to it.

Are my photos uploaded anywhere?

No. All processing happens inside your browser using the standard canvas API. Your image is not uploaded to our servers, which is why there is no queue and why the tool keeps working if your connection drops. Images up to 300 MB are accepted.

My photo looks blocky after compressing to 20 KB. What can I do?

Reduce the dimensions first. A 12-megapixel photo squeezed into 20 KB has to throw away almost everything. Set the longest side to around 600 px, then compress, the result at the same file size will look dramatically better.

Can I compress a PNG to a small size?

PNG is lossless, so it cannot be tuned the way JPEG can, the only lever is dimensions. If you need a small file and the image is a photograph, switch the output format to JPEG. Keep PNG only when you need transparency or the image is a screenshot or line drawing.

Does compressing remove EXIF data like location?

Yes. The image is redrawn from its pixels, so camera metadata including GPS coordinates is not carried through to the output. That is usually what you want when sending a photo to a form.

Requirements this tool handles