How to Resize an Image to an Exact File Size (KB or MB)

You're filling out a passport application, a government exam form, or a job portal upload — and there it is, in small print: "Photo must be under 100 KB." Or maybe it's the opposite: "File must be at least 200 KB and no more than 2 MB." Your phone photo is 3.4 MB. Your scanned signature is 4 KB. Neither one fits.

So you open an editor, drag a quality slider, export, check the size, and it's still wrong. You try again. And again. Ten minutes later you're still guessing your way toward a number that should have taken ten seconds.

The problem is that file size isn't something you can set directly — not the way you set width or height in pixels. It's an output, not an input. But once you understand what actually controls it, hitting an exact KB or MB target becomes a fast, repeatable process instead of a guessing game.

⚡ Quick Answer

You can't set a file size directly like you set dimensions — it's a byproduct of quality and pixel count, not an adjustable field. To hit an exact KB or MB target, a tool compresses the image, checks the resulting size against your target, and adjusts the quality (and dimensions, if needed) up or down until it lands at or just under the limit. Doing this by hand means repeated trial and error; a dedicated exact-size resizer automates the whole loop in one pass.

1. What "resizing to an exact file size" actually means

Every image file has two separate properties that people often confuse: its dimensions (how many pixels wide and tall) and its file size (how many kilobytes or megabytes it takes up on disk). Changing one doesn't automatically fix the other in a predictable way — file size is downstream of several things at once: pixel dimensions, compression quality, color complexity, and format.

"Resizing to an exact file size" really means running a search: try a compression setting, measure the output, and adjust — repeating until the result lands at or under your target number. This is sometimes called target-size compression or size-constrained encoding. It's fundamentally different from simply moving a quality slider once and hoping for the best, because the relationship between quality and output size isn't linear or fully predictable in advance.

📌 The key distinction Resizing changes pixel dimensions. Compressing changes quality/detail retained. Hitting an exact file size usually requires adjusting both together, guided by repeated measurement — not a single manual setting.

2. Why exact file size limits exist and matter

Strict KB and MB caps aren't arbitrary. They show up constantly across systems that were built years ago, or that operate at massive scale, where every extra kilobyte multiplied across millions of uploads adds real infrastructure cost.

20–200 KB typical photo size cap on government and exam portals
±0 KB tolerance most portals give — even 1 KB over gets rejected
2–5 MB common upload ceiling on job boards and application systems
10× typical gap between a raw phone photo and a portal's max size

Beyond forms, exact size targeting matters for email attachment limits, CMS media libraries with storage quotas, print-shop upload specs, and API payload limits where a request over a certain size is rejected outright rather than throttled. In every one of these cases, "close enough" isn't good enough — the system checks a hard number, and missing it means resubmitting from scratch.

3. Step-by-step: how to hit an exact target size

These steps work whether you're doing it manually in an editor or using an automated tool — the automated version just runs this loop for you instantly.

1
Note your exact target and format requirement

Read the requirement carefully — "under 100 KB" and "exactly 100 KB" are different constraints, and some portals also specify format (JPEG only) or minimum dimensions. Confirm all three before you start: max size, format, and any dimension requirement.

2
Start with dimensions that make sense for the target

A 4000×3000 photo has no realistic path to 50 KB without severe artifacts. Roughly match resolution to target size first — for very small targets (under 200 KB), resizing down to something like 800×600 gives the compressor far less data to work with, preserving more visible quality at the final size.

3
Choose a lossy format with an adjustable quality scale

JPEG or WebP are the right choices here, since both let you dial quality smoothly from 0–100 and get a predictable size response. PNG's lossless nature makes it far harder to hit a small target without palette quantization, so convert to JPEG/WebP first unless transparency is required.

4
Compress, measure, and compare against the target

Export at a starting quality (around 80 is a reasonable midpoint), then check the resulting file size. If it's above your target, lower quality and re-export. If it's well under, you can raise quality slightly to use up the available headroom — no reason to over-compress if you don't need to.

5
Narrow in with smaller adjustments each pass

Treat this like a binary search: big quality jumps first (80 → 60 → 40), then smaller refinements (55 → 58 → 57) once you're close. Most images converge to within a few KB of a target in 3–6 passes done this way, rather than dozens of random guesses.

6
Leave a small safety margin under strict maximums

If a portal states "maximum 100 KB," target 92–96 KB rather than exactly 100. File systems, encoders, and byte-counting conventions can vary by a few hundred bytes, and landing exactly on the ceiling risks rejection over a rounding difference.

7
Check the result visually, not just numerically

A file that hits the exact KB target but shows heavy blocking artifacts around faces or text has technically succeeded and practically failed. If quality looks poor at the required size, that's usually a signal the starting dimensions were too large — go back to step 2 and resize down further before recompressing.

Skip the trial and error — hit any target size instantly Enter your KB or MB target and get a compressed image that matches it. Runs entirely in your browser.
Open Exact File Size Resizer →

4. Common mistakes that miss the target

Adjusting only dimensions, never quality

Resizing a 4000×3000 photo down to 1000×750 shrinks the file, but if it's still saved at maximum JPEG quality, it may still be far larger than a strict KB target. Dimensions and quality both need to move together for small targets.

Jumping straight to an extremely low quality setting

Going from quality 90 straight to quality 10 to "guarantee" you're under the limit usually overshoots badly, producing a file well below the target with visible artifacts, when a moderate setting would have hit the target cleanly.

Ignoring the format requirement

Some portals silently reject WebP or PNG even if the file size is correct, because they only accept JPEG. Always confirm accepted formats before spending time hitting a size target in the wrong one.

Landing exactly on the stated maximum

A file at precisely 100.0 KB against a "100 KB max" rule can still get rejected due to rounding differences between how your tool and the portal's server count bytes (1000 vs. 1024 per KB). Leave a small margin instead of cutting it exactly to the limit.

Forgetting metadata is part of the file size

EXIF data, GPS tags, and color profiles count toward your total file size just like pixel data does. On a very tight target (under 20 KB), 5–10 KB of metadata can be the difference between passing and failing — strip it before your final compression pass.

5. Real-world examples

These examples walk through exactly how each target size gets hit in practice.

Example 1
Passport photo, target: under 50 KB
Original phone photo3.1 MB
Resized to 600×600640 KB
JPEG quality 7258 KB
JPEG quality 65 (final)47 KB
Example 2
Exam form upload, target: exactly 100–200 KB
Original scan1.8 MB
Resized to 1000×1300410 KB
JPEG quality 78190 KB
JPEG quality 74 (final)168 KB
Example 3
Job portal resume photo, target: under 2 MB
Original DSLR export8.4 MB
Metadata stripped8.1 MB
JPEG quality 88 (final)1.7 MB
Example 4
Signature scan, target: under 10 KB
Original scanned PNG240 KB
Converted to JPEG, resized 300×15022 KB
JPEG quality 60 (final)9 KB

6. Method comparison: manual vs. automated targeting

Here's how the common approaches stack up when your goal is a specific KB or MB number rather than "as small as possible."

Method Hits exact target? Speed Quality control Best for
Manual slider + re-export loop Eventually Slow (multiple passes) Manual judgment each time One-off edits with no urgency
Fixed quality preset (e.g. "web quality") Rarely Fast None — output size varies by image General web use, not strict limits
Dimension resize only Rarely Fast Preserves detail per pixel Loose size reduction, not hard caps
Automated target-size tool Reliably Instant Optimized automatically for the target Forms, portals, strict KB/MB limits

The pattern holds across use cases: anything with a hard numeric limit — a government form, an exam portal, an application system — is best served by a tool built specifically to search for that target, rather than a general-purpose compressor that only offers a quality slider and hopes the result lands close enough.

🎯 The core idea You're not compressing "as much as possible" — you're compressing to a specific number. That's a different job, and it's worth using a tool built for exactly that rather than adapting a general compressor by trial and error.
Need a photo compressed to an exact KB or MB size? Free, in-browser targeting — no upload required.
Open Exact File Size Resizer →

7. Frequently asked questions

How do I resize an image to an exact file size, like 200 KB? +
You can't set file size directly the way you set width or height — file size is a result of quality and dimensions, not an input. The reliable method is iterative compression: encode the image, check the resulting size, and adjust the quality setting up or down until the output lands at or under your target. A good tool automates this loop for you.
Why do government forms and job portals ask for a maximum file size in KB? +
Older upload systems and government portals often cap file sizes at 20–200 KB to limit server storage and bandwidth, especially at scale across millions of applicants. These limits are usually strict maximums, not suggestions — an upload even 1 KB over the limit will typically be rejected outright.
Does resizing dimensions or lowering quality get me to a target size faster? +
Both work, but they trade off differently. Lowering quality keeps the same dimensions but introduces compression artifacts at low settings. Reducing dimensions preserves visual sharpness better for small target sizes, since there's simply less data to encode. For very aggressive targets, combining both usually beats either alone.
Which file format is easiest to hit a small target size with? +
JPEG and WebP are far easier to target than PNG, because both use adjustable lossy quality settings that scale file size smoothly. PNG is lossless, so its size depends on color count and content complexity rather than a quality slider, making it much harder to hit an exact KB target without visibly degrading the image through palette reduction.
Why does my image come out well under the size limit but looks blurry? +
This usually happens when a tool cuts quality too aggressively in one pass to guarantee it stays under the limit, overshooting instead of targeting the ceiling. A better approach checks the result after each compression pass and stops as close to the limit as possible, rather than jumping straight to a very low quality value.
Can I hit an exact file size without any visible quality loss? +
It depends how far you need to go. Going from 4 MB to 1 MB is usually achievable with no visible loss, since most of that is metadata, oversized dimensions, and unnecessary bit depth. Going from 4 MB to 50 KB will almost always introduce some visible compression artifacts, because that ratio requires discarding real image detail, not just overhead.

Hit your exact file size target right now — free

The Rebrixe Exact File Size Resizer runs entirely in your browser. Set your KB or MB target, and it handles the quality and dimension adjustments automatically. No signup, no uploads to a server.

Launch the Exact File Size Resizer →
← Back to Guides