How this compressor works
FileToKB does one thing: it takes an image you already have and makes it land under a file size you were told to hit — 20KB for an exam form, 100KB for a bank upload, 500KB for a job portal. It runs entirely in your browser tab.
The method, step by step
Your image is decoded into a canvas element. The tool then re-encodes it as JPEG or WebP at a range of quality levels and measures the resulting byte count each time. It uses a binary search over the quality scale, so it converges on the highest quality that still fits your target in around eight attempts rather than trying every value.
If the image still will not fit at the lowest usable quality, the tool starts scaling the pixel dimensions down in steps and repeats the search. That is why a 12-megapixel phone photo squeezed to 20KB comes back visibly smaller in dimensions: at that size there is no other way.
What it cannot do
It cannot add detail back. A 20KB target on a detailed photo will look soft, and no tool can change that — the information is being thrown away on purpose.
PNG has no quality dial. A PNG can only be made smaller by reducing its dimensions or its colour count, so when a PNG has to hit a small target the tool converts it to JPEG or WebP unless you tell it not to. Transparent areas become white when that happens, and the tool warns you before it does it.
Where the size requirements come from
Target sizes quoted on pages of this site are the ones users most often search for. Where a page names a specific form or portal, the requirement is quoted from that organisation's own published instructions and linked. Anything we could not verify against a primary source is left out rather than guessed at.
Requirements change without notice. Always check the upload page in front of you before trusting a number you read here.
FileToKB — Compress an image to an exact KB size, in your browser. Page updated 2026-09-04.