How to Compress a Photo to Under 40 KB (Step by Step)
Reviewed by the FreeOnline.fyi team · Updated 2026-09-13
Why 40 KB keeps showing up on upload forms
If you've ever filled out a government recruitment form, a visa application, a scholarship portal or a university admission page, you've met the same sentence: "photo must not exceed 40 KB." The number isn't a quality standard — it's a storage and bandwidth decision made by whoever runs the server, and it's usually enforced as a hard rejection rather than a warning. Your phone happily produces 3–8 MB photos, so you're often ninety times over the limit.
That mismatch is the entire reason we built Photo Compressor To 40kb. The job is small and specific: take a normal photo, land at or just under the cap, keep the picture as large and as sharp as the cap allows, and hand it back in one tap. No account, no email, no waiting on a server queue.
Step 1 — Drop the photo in and read the before/after numbers
Open the tool and drop a JPG, PNG or WebP into the dashed zone, or tap it to pick from your camera roll or gallery. We accept a single image up to 25 MB; anything that isn't an image type is rejected with an inline message rather than a silent failure, and multi-file drops take the first file so you don't accidentally queue a batch you didn't intend.
The moment the file loads, the result panel shows the original and the compressed version side by side, with the before size, the after size and the percentage saved. That comparison view is deliberate: the KB number dropping is the thing you came for, but you also need to see whether the frame is still sharp enough to submit. On mobile the layout stacks — drop zone, then an "Adjust" accordion for the controls, then the preview, with a full-width Download bar pinned above the fold.
Step 2 — Set the cap and let the tool find the largest size that fits
The target defaults to 40 KB. It's an integer field from 1 to 2000, and if you type something below 10 KB the tool warns you that quality will suffer — that warning is honest, not decorative. A photograph squeezed into single-digit kilobytes is going to show blocking and smeared edges no matter how clever the encoder is.
The Max dimension dropdown is where most of the quality actually comes from. Set to "auto", the tool starts at a 2000 px longest side and searches downward — the rationale being that pixel count is the cheapest thing to trade away. Halving the dimensions cuts the pixel count to a quarter, which buys a much higher JPEG quality setting for the same byte budget than leaving a 4000 px image intact and crushing the quality slider instead. If the portal specifies a size — many ID-photo forms want something in the 200–600 px range — pick 1600, 1200, 800, 600, 400 or 200 directly so you don't have to guess twice.
Format is JPEG by default, with WebP as an option. A PNG dropped in here is converted to JPEG for photos, because PNG is a lossless format and a photographic PNG will essentially never reach 40 KB without absurd downscaling. That conversion is the right call for faces and scenes, but if your image is a logo, a signature scan or line art, expect JPEG's ringing artifacts around hard edges — a specialist tool will serve you better there.
Step 3 — Check the spec readout, not just the KB number
Under the preview you get a spec line: final file size, pixel dimensions, output format and the quality level the encoder settled on. Read all four. A file that hits 39 KB but ends up at 190 × 230 px may sail past the size check and then get rejected by a form that also demands a minimum resolution — a very common pattern on ID and visa uploads, which sometimes ask for an exact width and height with a narrow size band.
So the practical check is: does the number match the cap, and do the dimensions look sane for a human face at the size the form displays them? Zoom the preview to 100% and look at the eyes, the hairline and any text on a sign or badge in the background. Smooth gradients (skies, studio backdrops) hide compression well; sharp text and thin patterns do not.
The most frequent mistake we see is people assuming that hitting 40 KB is the only requirement. Others: uploading the compressed file but forgetting the portal also has a minimum file size, or submitting a photo where the head is too small in frame because they accepted an aggressive downscale instead of cropping first. If your form demands exact pixel dimensions or a specific head-to-frame ratio, crop to that ratio before you compress — the compressor will then spend its whole byte budget on quality rather than on pixels you were going to lose anyway.
What happens to EXIF and GPS, and why that's a feature
Phone photos carry EXIF metadata: camera model, timestamp, and often precise GPS coordinates. By default this tool strips that metadata, because the last thing you want is your home coordinates riding along inside a job application. The underlying standard for that metadata is published by CIPA, and its presence is invisible in any image viewer that doesn't read it — the pixels look identical either way.
There's a toggle if you genuinely need to keep the metadata, for instance when a portal validates the capture date. Turn it on and the tags survive; leave it off for anything public-facing. Either way, the conversion happens in your browser using the Canvas and encoding APIs, which means the image is never uploaded anywhere and the tool keeps working if your connection drops after the page loads. You can read more about how browser-side image formats behave in the MDN guide to image file types.
When 40 KB isn't your number
Caps vary wildly: 20 KB on some exam forms, 50 KB or 100 KB on others, and 200 KB on plenty of modern portals. Rather than re-teaching yourself a new workflow each time, use the same approach with the right target — we have dedicated pages for compressing a photo to 20 KB and for a 50 KB JPG limit that share the same engine.
A reasonable habit before you submit anything important: keep the original full-resolution file, compress a copy, and open the result once more in your own image viewer to confirm it looks right. Then verify the actual portal page, since requirements change without notice and an old forum post is not a specification. The JPEG format is lossy by design, so no compressor — ours included — can promise a 40 KB file that's pixel-identical to the original. What we can promise is that you'll see the exact final size, dimensions and format before you download, so there are no surprises at the upload button.