ImageInKB

Resize an image to an exact size in KB

Your form says “photo must not exceed 50 KB”. Most compressors shrink the file somewhere near that and leave you guessing. This one searches for the largest photo that still fits under the number you type.

  • Nothing is uploaded — it runs in your browser
  • 1 KB counted as 1024 bytes, like the forms do
  • GPS and camera data stripped, orientation kept

Your photo never leaves this tab. The resizing happens inside your own browser — nothing is uploaded to us, and we cannot see the file.

Your image
No file chosen yet

JPEG, PNG or WebP, up to 25 MB. On a phone you can shoot it now.

How the exact size is found

JPEG has no “make this 50 KB” setting. It has a quality dial, and how many bytes a given quality produces depends on the photograph itself. So the size has to be searched for.

  1. 1

    Decode in the tab

    The image is read by your own browser. Rotation from the EXIF tag is applied so portraits stay upright; everything else in that block — camera model, timestamp, GPS — is dropped on the way out.

  2. 2

    Halve the range, eight times

    Encode, measure, and move the quality bounds toward the answer. Each pass cuts the remaining range in half, which is why eight passes are enough to land just beneath your limit rather than far below it.

  3. 3

    Shrink pixels only if forced

    If even the lowest usable quality overshoots, the picture is scaled down 10% and the search runs again. Losing resolution is the last resort, and the result tells you when it happened.

Why the result is usually a little under your number. Going over the limit means the form rejects the upload, so the search only ever accepts a file that fits. Landing at 48 KB against a 50 KB limit is the correct outcome — landing at 50.4 KB would be a failure.

What the tool actually does

1 KB = 1024 B
The same arithmetic the forms use. A tool that counts 1000 bytes to a kilobyte overshoots a 50 KB limit by 2.4% — and the form rejects it.
8
Binary-search steps over JPEG quality. Each step halves the remaining range, so the result lands just under your target instead of far below it.
85%
The lower bound we accept. Landing at 12 KB when you asked for 50 is technically “under the limit” and visually a waste of a photograph.
25 MB
Largest file the tool will open. Everything is decoded inside the browser tab, and past this size phones start running out of memory.
0
Bytes of your image sent anywhere. There is no upload step in the code — open the network tab and check while you use it.
10%
Pixel reduction per step, used only when the lowest quality still will not fit. Dropping resolution is a last resort, not the first move.

Two ways to hit a size limit

Approach When this helps Where it falls short
A general image compressor Making a page load faster, where any reduction is a win and nobody checks the number. It picks a quality level and hands you whatever comes out — 38 KB, 61 KB, 12 KB. When the form says “maximum 50 KB”, “whatever comes out” is a coin toss, and you compress again and again.
Compressing to a target (this tool) Filling in a form that states a hard limit in kilobytes and rejects the upload if you miss it. It only outputs JPEG. If your form demands PNG at a fixed weight, this is the wrong tool — and PNG cannot hit an arbitrary size anyway.

When this tool is the wrong choice

Where this tool stops being the right answer — and what to use instead.

Words the forms use

KB
Kilobyte. Government portals mean 1024 bytes, so 50 KB is 51 200 bytes. Tools that use 1000 produce files that fail validation.
JPEG quality
A 0–100 dial trading detail for bytes. There is no fixed relationship between quality and file size — it depends entirely on the picture, which is why the size has to be found by search rather than by formula.
EXIF
Metadata your camera writes into the file: orientation, date, camera model, and often GPS coordinates. This tool keeps the orientation and discards the rest.
Aspect ratio
The width-to-height proportion. Compressing never changes it; cropping does. Forms that specify 3.5 × 4.5 cm are specifying ratio.

Questions people ask before uploading a photo

Is my photo uploaded to your server?
No. The compression runs in JavaScript inside your browser tab. There is no upload request in the code at all — you can confirm it in your browser’s network inspector while the tool works. This matters because the files people bring here are ID scans and photographs of their own face.
Why does the result come out at 48 KB and not exactly 50 KB?
JPEG size moves in steps, not continuously — you cannot dial an arbitrary byte count. The tool searches for the largest file that still fits under your limit, because going over means rejection. Landing a little under is the correct answer; landing over is a failure.
The form also asks for specific pixel dimensions. Does this handle that?
Only indirectly. The tool reduces pixels when quality alone cannot reach the target weight, and it tells you when it did. If your form checks dimensions as a separate rule, verify them on the result before you submit.
What happens to the GPS coordinates in my photo?
They are gone. The result is redrawn onto a canvas, and that process carries no metadata across — camera model, timestamp and location do not survive it. The one thing deliberately preserved is the orientation flag, so a portrait photo does not come back lying on its side.
Can I compress the same photo again to a different size?
Yes, and each attempt starts from your original file rather than from the previous result. Compressing an already-compressed image twice would stack the losses and look noticeably worse.
My phone photo is HEIC. Will it work?
It depends on the browser — support for HEIC is uneven, and we do not pretend otherwise. If your browser cannot open it, the tool says so plainly instead of failing silently. Sharing or exporting the photo as JPEG from your gallery app solves it.