Compress Image to Target Size (KB)

Shrink a JPG, PNG or WebP image down to an exact file-size limit — type the maximum KB (or pick a preset), and the tool finds the best quality that fits. Perfect for exam-form photo and signature uploads that demand “under 50 KB”. Everything runs locally, so nothing is uploaded. Last reviewed 2026-06-19.

Drop an image here, or browse

JPG, PNG, WebP, GIF, BMP — processed locally, never uploaded.

How it works

Many upload forms reject an image that is over a hard size limit — a typical exam portal wants the photo under 50 KB and the signature under 20 KB. This tool draws your image onto an HTML <canvas> and re-encodes it as JPEG or WebP, running a binary search on the quality to find the highest setting whose file is still under your target. If even the lowest quality is too large, it steps the dimensions down and tries again, so it always lands just under the limit (never over). Because it all happens in your browser, the picture is never sent anywhere, and the re-encode strips EXIF/GPS as a side effect.

Common target sizes

TargetTypical use
20 KBSignatures on exam forms (SSC, IBPS, UPSC)
50 KBPassport-style photos on most government / exam portals
100 KBGeneral web images, profile pictures, KYC uploads
200 KBEmail attachments, document scans
500 KBHigher-quality web photos
1 MBPrint-ish quality while staying under 1 MB

Tips to hit a tiny target

  • Crop tight first. A photo cropped to just the face (or just the signature) compresses far smaller than one with lots of background.
  • Choose WebP when the form accepts it — WebP reaches the same target at noticeably higher visual quality than JPEG, or hits a smaller target JPEG can’t.
  • Leave “Resize if needed” on for very small limits (≤ 20 KB). A 20 KB signature usually needs both low quality and smaller dimensions.
  • Match the required pixel size. If a form says “200×230 px”, resize to that first — there is no point encoding more pixels than the form keeps.

Good to know

  • The result lands just under your target (e.g. ~47 KB for a 50 KB limit) so the upload is always accepted.
  • PNG is lossless and can’t be tuned to a KB target by quality, so the output is JPEG or WebP — which is what KB-limited forms expect anyway.
  • Animated GIFs / animated WebP are flattened to their first frame (canvas captures a single frame).
  • Your original file is never modified; you always download a new copy.

Why upload forms impose a KB limit at all

A "maximum 50 KB" rule can feel arbitrary when your phone happily produced a 4 MB photo, but it exists for solid engineering reasons. Government and exam portals receive millions of applications in a short window; every kilobyte is multiplied by every applicant, so a 50 KB cap instead of a 2 MB free-for-all is the difference between a few gigabytes of storage and several terabytes, and between forms that submit on a patchy mobile connection and forms that time out. Small images also display faster to the clerks and verifiers who review them, and they keep the database and its backups manageable. The limit is a deliberate constraint, which is exactly why a tool that lands just under it — rather than guessing — saves you the cycle of "resize, upload, rejected, try again."

KB vs KiB: why a "50 KB" file is really 51,200 bytes

There is a quiet ambiguity in every file-size limit. Strictly, a kilobyte (KB) is 1,000 bytes, while the unit operating systems and most upload forms actually mean is the kibibyte (KiB) — 1,024 bytes. Almost every "KB" limit on an exam or KYC portal is really 1,024-byte units, so a "50 KB" cap is 50 × 1,024 = 51,200 bytes. This tool uses the 1,024-byte convention to match how those forms and your file manager count, which is why the achieved size it reports lines up with what the upload form sees. It is also why aiming for a result a hair under the limit (say 47–49 KB for a 50 KB cap) is the safe play — it absorbs any rounding difference between how two systems define a kilobyte.

How the binary search nails the target

JPEG and WebP expose a single quality dial from roughly 1 to 100, where lower means a smaller file. The naïve approach — try 90, too big, try 80, too big, try 70… — wastes encodes and can overshoot. Instead the tool runs a binary search. It encodes once at the lowest quality to confirm the target is even reachable at the current dimensions, then repeatedly tests the midpoint of the remaining quality range: if the encode fits under the target it remembers it and searches higher (better quality), and if it overshoots it searches lower. Each step halves the range, so a handful of encodes converges on the highest quality whose file is still under your limit — the best-looking image that fits. This works because file size moves monotonically with the quality dial: turn quality up and the file only ever grows, which is the property a binary search needs.

If even quality 1 is still too large at full size, no quality setting can save you, so the tool steps the dimensions down and searches again. That two-level strategy — quality first, then size — is why it can hit a target as tight as a 20 KB signature that quality alone could never reach.

The quality scale is not linear

It is tempting to assume quality 50 produces a file half the size of quality 100, but encoders do not behave that way. The top of the scale is expensive: dropping from 100 to 90 often removes detail you cannot see while cutting the file dramatically, because the very highest quality levels spend most of their bytes on imperceptible fine-grain information. The bottom of the scale is where artefacts live: below about 40–50 the 8×8 JPEG blocks and colour fringing become visible. The practical consequence is that the same target size lands at a comfortable quality on a simple image (a signature, a flat-background portrait) and at a harsh quality on a busy one (a detailed photo with lots of texture). That is the real reason the tips below tell you to crop tight first — fewer competing details means the encoder can hold a higher quality within the same byte budget.

Typical Indian exam, passport and KYC photo specs

Most application portals specify four things: the file format, the file-size limit, the pixel dimensions, and the background. The table below shows the kinds of values you will commonly meet — but exact figures change from exam to exam and from year to year, so always confirm the numbers in the official notification or upload-page instructions before you rely on them.

ItemTypical format & sizeNotes
Exam photograph (SSC, IBPS, RRB, NEET)JPG, commonly ~20–50 KBRecent colour photo, plain light background, face clearly visible.
SignatureJPG, commonly ~10–20 KBSigned in black ink on white paper, then scanned or photographed.
UPSC / large application portalsJPG, often up to ~300 KBMore generous limits; still want a clean, in-focus image.
Indian passport / visa photoPrint 35 × 45 mmHead centred with light background; the portal also sets a KB limit.
Bank / KYC document scanJPG or PDF, often ~100–200 KBLegible text matters more than resolution.

The reliable workflow for any of these is the same: crop to the required shape, resize to the required pixel dimensions, then compress to the KB limit last — that order preserves the most quality, because you only ever ask the encoder to fit the pixels the form will actually keep.

Pixels and bytes are two different limits

A form can constrain your image in two independent ways, and it helps to keep them separate. The pixel dimensions (say 200 × 230 px) control how much actual picture there is; the file size in KB controls how many bytes that picture is allowed to take up. Resizing changes the first directly and the second indirectly — fewer pixels almost always means fewer bytes. Compressing changes only the second, by encoding the same pixels more roughly. If a portal demands both an exact pixel size and a KB cap, set the dimensions first (there is no point encoding more pixels than the form stores), then let this tool find the quality that fits the byte budget. Starting from a tightly-cropped, correctly-sized image is the single biggest thing you can do to make a tiny target reachable at decent quality.

When a target is mathematically impossible

Sometimes a limit genuinely cannot be met without destroying the image — for example, asking a large, highly-detailed scan to fit in 10 KB while keeping its full dimensions. When that happens the tool gives you the smallest version it could produce and tells you plainly that it could not reach the target, rather than silently shipping something over the limit. The escape hatches are: turn on "Resize if needed" so it can shrink the dimensions; switch to WebP, which compresses harder than JPEG and can reach sizes JPEG cannot; crop away background so there is less to encode; or, where the rules allow, raise the target slightly. One of those almost always opens up the space the encoder needs.

Frequently asked questions

Is my image uploaded to a server?
No. The image is decoded and re-encoded entirely in your browser using the built-in Canvas API — it never leaves your device and is never logged or transmitted. It also works offline once the page has loaded, so it is safe for private photos, ID documents, signatures and exam-form uploads.
How does it hit an exact size like 50 KB?
JPEG and WebP have a quality dial from 1 to 100 — lower quality means a smaller file. The tool runs a binary search on that quality to find the highest setting whose encoded size is still under your target, so you get the best-looking image that fits the limit. If even the lowest quality is too big, it automatically shrinks the dimensions a step at a time until the target is reachable.
Why does it compress to a JPG and not keep my PNG?
PNG is lossless — it has no quality dial — so you cannot reliably tune a PNG to an exact KB target; only its dimensions affect its size. Almost every form that imposes a KB limit wants a JPG anyway. So this tool outputs JPEG (or WebP), which is exactly what those uploads expect. If you specifically need a smaller PNG, use the regular Image Compressor and resize it.
The result is a bit under my target, not exactly equal — is that a problem?
No, that is by design and is what you want. A "≤ 50 KB" limit means the file must not exceed 50 KB, so the tool always lands just under the target (e.g. 47–49 KB for a 50 KB limit) rather than risk going over. Landing slightly under guarantees the upload is accepted.
What if my target is too small to reach?
If even the lowest quality at the smallest sensible dimensions is still larger than your target, the tool gives you the smallest version it could make and tells you it could not reach the limit. Try enabling "Resize if needed", choosing WebP (it compresses harder than JPEG), or raising the target a little.
Does it remove EXIF / GPS metadata?
Yes. Re-encoding through the canvas produces a clean image with no EXIF block, so camera model, date and GPS location are stripped automatically — a privacy bonus when uploading photos. Keep your original if you want to preserve that metadata.

Related tools

See all browser tools →

Sources and standards

This tool follows the published specification for what it does, rather than a hand-written approximation. The references below are the primary documents it implements — each one is the authority for the rules applied on this page.

Descubre más herramientas

Ver las 70 herramientas →