Compressing a Photo to an Exact File Size

By Udit Agarwal · Updated October 18, 2026

To compress an image to an exact size such as 50 KB, you lower its JPEG quality until the file fits under the limit and, when even a low quality is not enough, reduce its pixel dimensions as well. No single setting works for every photo, because the bytes a picture needs depend on its dimensions and content as much as on the quality slider. Upload forms add two traps of their own: they may count a kilobyte as 1,000 or 1,024 bytes, and they often fix the pixel dimensions too.

What upload forms usually ask for

Job portals, exam boards and government services set strict upload rules and reject a file even a few bytes over. Details differ, so read the instructions, but the same patterns recur:

  • a photo of 20 to 50 KB, or up to 100 or 200 KB on more generous forms;
  • a signature of 10 to 20 KB;
  • scanned documents of a few hundred kilobytes to a couple of megabytes;
  • often JPG only, sometimes with fixed pixel dimensions (such as 200 × 230 for an exam photo) or a minimum, as in "between 20 KB and 50 KB".

What decides an image's file size

Factor Effect on file size
Pixel dimensions Size grows roughly with the pixel count. Halving the width and height leaves a quarter of the pixels.
Format JPG and WebP are lossy and small. PNG is lossless and several times larger for a photo.
Quality setting Lower quality rounds off more detail and saves bytes; pushed too far, the picture turns blurry and blocky.
Content Fine detail and noise (leaves, gravel, low-light grain) need far more bytes than a face against a plain wall.
Metadata Camera details, GPS data and an embedded preview add bytes that matter at 20 KB.

The blockiness has a simple cause. The JPEG standard (ISO/IEC 10918-1) cuts the picture into blocks of 8 × 8 pixels and stores each block's detail as frequencies, which the quality setting rounds more or less coarsely. At low settings most of the detail is rounded away and the block edges show.

The pixel budget: why some limits need fewer pixels

A size limit is a budget of bits. Multiply the limit by 8, divide by the number of pixels, and you get the bits each pixel may use. An uncompressed colour photo uses 24 bits per pixel. JPEG typically compresses about 10:1 with little visible loss, which is about 2.4 bits per pixel.

Here is what a 50 KB limit (51,200 bytes, counting 1,024 bytes per KB) allows:

Picture size Pixels Bits per pixel at 50 KB Compression needed
4032 × 3024 (12 MP phone photo) 12.2 million 0.03 about 714:1
800 × 600 480,000 0.85 about 28:1
413 × 531 (35 × 45 mm at 300 dpi) 219,303 1.87 about 13:1
200 × 230 46,000 8.9 about 3:1

The full phone photo would need about 70 times more compression than JPEG's comfortable 10:1. No quality setting gets there and leaves a recognisable picture, and even the lowest setting has a floor, because every 8 × 8 block still costs a few bits. The only way down is fewer pixels.

Working backwards gives a rough guide to the dimensions that fit each limit at about 10:1:

Limit Pixels that fit Example size (4:3)
20 KB about 68,000 about 300 × 225
50 KB about 171,000 about 475 × 355
100 KB about 341,000 about 675 × 505
200 KB about 683,000 about 955 × 715

Treat these as starting points: a plain portrait fits more pixels than a detailed scene, and a lower quality fits more at the cost of softening. If the form also mentions DPI, see image size, resolution and DPI.

KB, kB or KiB: which kilobyte does the form mean?

Kilo means 1,000, so 1 kB is 1,000 bytes, but computers count in powers of two and 1,024 bytes was long called a kilobyte too. The IEC binary prefixes (IEC 80000-13) call 1,024 bytes a kibibyte (KiB), yet most forms just say KB. Windows File Explorer counts 1,024 bytes per KB; macOS Finder counts 1,000.

Limit Counted as 1,000 bytes Counted as 1,024 bytes
20 KB 20,000 bytes 20,480 bytes
50 KB 50,000 bytes 51,200 bytes
100 KB 100,000 bytes 102,400 bytes
200 KB 200,000 bytes 204,800 bytes
1 MB 1,000,000 bytes 1,048,576 bytes

A file of 50,500 bytes is 49.3 KB counted one way and 50.5 KB counted the other, so it passes a 50 KB limit on one site and fails on another. Aim a little under: for a 50 KB limit, a target of 48 KB (49,152 bytes) fits under either reading.

A method that works for any limit

  1. Read the rules: format, maximum and minimum size, pixel dimensions and background colour.
  2. Convert an iPhone HEIC photo to JPG with the HEIC to JPG Converter; many forms do not accept HEIC.
  3. Crop to the framing the form wants, such as head and shoulders, with the Image Cropper.
  4. Resize to the required dimensions with the Image Resizer, or to a size from the table above if none is given.
  5. Compress to the limit, aiming slightly under it.
  6. Check the result at 100 percent zoom: a sharp face, readable text, a clean signature.

Keep the original: a JPG loses a little more detail every time it is recompressed, so start from the best copy.

Photos and signatures

For an ID photo, size comes before compression. The Passport Photo Maker crops to an exact pixel size, with presets for many countries and a 200 × 230 exam-form size, and can cap the JPG at a size in KB by lowering the quality while the pixels stay fixed. At 200 × 230, a 50 KB limit allows almost 9 bits per pixel and 20 KB about 3.6, so the photo can keep a high quality.

Signatures compress well when the background is clean. Sign with a dark pen on plain white paper, photograph it flat in even light, and crop tightly so the file holds ink rather than shadowed paper. The Signature Background Remover lifts the ink into a transparent PNG, 600, 300 or 150 pixels tall if you want it smaller; compressed to a JPG, the transparent background turns white.

A scanned document follows the same rules, but if the form takes a PDF, read why PDFs get big or use Compress PDF to Size.

How a target-size compressor finds the quality

There is no formula from a byte limit to a quality setting, so a target-size compressor searches: it saves the picture, measures the file and adjusts. ArrayKit's search runs like this:

  1. Save at 95 percent quality, full size. If that fits, keep it.
  2. Otherwise try 5 percent. If that fits, search between the two, halving the range with each attempt and stopping once a result lands within 3 percent under the target.
  3. If even 5 percent is too big, find the largest scale that fits at 72 percent quality, then raise the quality as far as that size allows.
  4. If nothing fits at the smallest size you allow, say so and offer the smallest file made.

For a 50 KB target, that usually means a result between about 48.5 KB and 50 KB: the highest quality that fits, not the smallest possible file.

Compress an image to an exact size with ArrayKit

Compress Image to Size runs that search for you. Pick a preset (20 KB, 50 KB, 100 KB, 200 KB, 500 KB, 1 MB or 2 MB) or type a target in KB or MB, from 1 KB to 100 MB; two shortcuts set Photo ≤ 50 KB and Signature ≤ 20 KB. It counts 1 KB as 1,024 bytes, so the 50 KB preset aims at no more than 51,200 bytes. Type 48 KB when a form might count in thousands.

It saves as JPG, or WebP in browsers that can write it. Lossless PNG, GIF and BMP files are converted, and transparency turns white in a JPG. An optional longest-side limit applies before the search, and a "Never below" setting (25 percent by default) stops the picture shrinking below that share of its original size. A photo already under the target is normally re-saved at about its own size rather than grown to fill the limit.

Each result shows the size before and after, the quality and scale used and the pixel dimensions. When a target cannot be reached, the tool says so and still offers the file. Up to 100 photos (PNG, JPEG, WebP, GIF, BMP, AVIF or SVG) are compressed one at a time and can be downloaded singly or as a ZIP. Everything happens on your device and nothing is uploaded; the new copy also drops EXIF data such as camera details and GPS location.

Frequently asked questions

How do I compress a photo to 50 KB? Resize it first; around 475 × 355 pixels suits 50 KB when the form sets no dimensions. Then lower the JPG quality until it fits, or let a target-size tool find the highest quality under the limit. Aim slightly under, such as 48 KB, in case the form counts 1,000 bytes per KB.

How do I reduce a photo to 20 KB without it looking terrible? Use fewer pixels rather than a very low quality. About 300 × 225 pixels fits 20 KB at a comfortable quality, while a full phone photo squeezed to 20 KB turns blurry and blocky. Crop tightly so the pixels go on the subject.

Why won't my image go under the limit even at the lowest quality? It has too many pixels. A 12-megapixel photo would need about 714:1 compression to fit 50 KB, far beyond what JPEG can do while keeping a recognisable picture. Reduce the dimensions and try again.

Is 1 KB 1,000 bytes or 1,024 bytes? Strictly, 1 kB is 1,000 bytes and 1,024 bytes is a kibibyte (KiB) under IEC 80000-13. In practice "KB" is used for both: Windows counts 1,024 and macOS counts 1,000. Aim a little below the limit and either reading passes.

Why did my PNG turn into a JPG? PNG is lossless, so there is no quality setting to lower; only fewer pixels would shrink it. JPG and WebP trade a little hard-to-see detail for a much smaller file, and transparent areas become white in a JPG.

Why does the form still reject my file? Check the other rules: wrong pixel dimensions, the wrong format, a minimum size or a different way of counting kilobytes can each cause a rejection, even under the limit.

Keep going

画像をKB指定で圧縮

More guides

  • HEIC Files, Explained — What a HEIC file is, why iPhones save photos as HEIC, how to open HEIC on Windows, and how to convert HEIC to JPG while keeping quality and dropping GPS data.
  • PNG vs JPG vs WebP, Explained — PNG vs JPG vs WebP: lossy and lossless compression, transparency, file sizes for the same photo, and the best image format for the web, photos and logos.
  • Image to Text: How OCR Works — How OCR turns an image to text: what affects accuracy (resolution, contrast, skew, fonts, language), why handwriting is hard, and how to make PDFs searchable.
  • Image Size, Resolution and DPI, Explained — What image dimensions, DPI and file size mean, how to pick the right pixel size for web and print, and why resizing is not the same as compressing or cropping.
  • Base64 Encoding, Explained — Base64 explained: how it turns binary into text, the alphabet and padding, the URL-safe variant, size overhead, use cases, and why it isn't encryption.
  • Linux File Permissions and chmod, Explained — What chmod 755, 644 and 777 mean: owner, group and others, read, write and execute, octal and symbolic modes, umask, setuid, setgid and the sticky bit.

All Images tools · All guides