Compress Image to a Target Size

Type a size such as 50 KB, 100 KB or 2 MB and the tool finds the highest JPEG or WebP quality that still fits under it — on your device, with nothing uploaded.

Every attempt is encoded in your browser. Your photos, which often include identity documents, are never uploaded, and the result carries no EXIF or location data.

Built and maintained by Udit Agarwal

Compressing a Photo to an Exact File Size

Set the pixel size first with the Image Resizer

About Compress Image to Size

Upload forms, job portals and exam sites publish a hard ceiling — 20 KB for a signature, 50 KB for a photo, 200 KB for a scan — and reject a file that is even a few bytes over. There is no formula from a byte limit to a quality setting, because the same slider position gives very different sizes for different pictures. So this tool searches: it encodes the photo, measures the result and narrows the quality range until it finds the highest quality that still fits. If even the lowest quality is too large, it shrinks the picture as well, but never below a minimum share of the original size that you control. Every result shows its size, quality and scale, and a photo that is already under the limit is re-saved without growing.

Features

  • Presets for 20 KB, 50 KB, 100 KB, 200 KB, 500 KB, 1 MB and 2 MB, plus any custom value in KB or MB
  • Searches for the highest quality that fits instead of guessing at a setting
  • Shrinks the picture too when quality alone cannot reach the target, within a minimum size you set
  • Optional longest-side limit applied before the search starts
  • Saves as JPEG, or WebP where the browser can write it
  • Live progress shows the quality and size of each attempt, with Cancel between attempts
  • Before and after previews with the exact size, quality and scale for every photo
  • Works through many photos in turn and packs the results into one ZIP

How to use the Compress Image to Size

  1. Drop, choose or paste your photos
  2. Pick a target size, or type your own and choose KB or MB
  3. Watch the search narrow in on the quality that fits
  4. Check the size, quality and scale on each card, then download one photo or the ZIP

Example

Input

passport.jpg — 2.4 MB
Target: 50 KB · save as JPEG

Output

passport.jpg 2.4 MB → under 50 KB (Under target)
scaled down at 72 % quality, then quality raised to the highest that still fits

Quality alone could not reach 50 KB, so the picture was shrunk first and the quality pushed back up at the new size.

Common errors & troubleshooting

  • It says it could not reach the target. — The limit is below what the picture can reach at the minimum size you allow. Lower the Never below percentage, resize the photo smaller first, or raise the target.
  • The photo looks blurry or blocky. — A very small target forces a low quality or a small picture. Choose the largest limit the form allows; a 20 KB file is a thumbnail-sized image.
  • A PNG's transparent background turned white. — PNG is converted to JPEG, which cannot be transparent, so see-through areas are filled with white. Choose WebP if the form accepts it.
  • The form still rejects a file that is under the limit. — Some forms count a kilobyte as 1,000 bytes and others as 1,024. Aim a little below the limit, and check whether the form also fixes the pixel dimensions.

Frequently asked questions

How does Compress Image to Size find the quality that fits my limit?
It encodes the photo at a high quality, measures the file, and narrows the quality range from both sides until the result lands just under your target. If even the lowest quality is too big, it reduces the picture size and searches again.
Why is my PNG converted to JPEG when I compress it to a size?
PNG is lossless, so lowering a quality setting does not shrink it — only fewer pixels would. JPEG and WebP trade tiny losses of detail for a much smaller file, which is what a byte target needs. Transparent areas turn white in a JPEG.
What happens if the target size is too small for my image?
The tool tries the lowest quality, then shrinks the picture down to the minimum share you allow. If it still cannot fit, it says so and offers the smallest result it made. Lower the minimum, raise the limit or resize the photo first.
Should I choose JPEG or WebP for the compressed image?
JPEG is accepted by virtually every upload form and viewer. WebP usually reaches the same quality at a smaller size and can keep transparency, but some portals refuse it. Use JPEG unless you know WebP is allowed.
Does compressing a photo here keep its EXIF and location data?
No. The photo is drawn and saved again, which drops EXIF metadata such as camera model, capture time and GPS position. The picture itself is kept as closely as the target allows.
What file sizes do government, exam and job forms usually ask for?
It varies, so read the form's instructions. Signatures are often limited to around 20 KB, passport-style photos to about 50 KB, and scanned documents to 100 to 500 KB or a couple of megabytes. Set the pixel size first if the form requires one.

Related tools

  • Image Resizer — Resize photos by pixels, percentage, preset or longest side — in batches, with a ZIP download.
  • Image Optimizer — Re-encode and shrink images (JPEG/WebP/PNG), optionally resizing.
  • Image Format Converter — Convert images between PNG, JPEG and WebP entirely in your browser.
  • Compress PDF to Size — Bring a PDF under an exact byte target such as 100 KB, 200 KB or 2 MB.
  • Passport Photo Maker — Crop a photo to passport and ID sizes and lay out a print-ready sheet of copies.
  • Base64 Image Encoder / Decoder — Convert images to Base64 Data URIs with ready-made HTML and CSS snippets, or decode a Data URI back to a downloadable image.
  • EXIF Viewer & Remover — View and strip EXIF metadata (including GPS) from photos — nothing is uploaded.

Guides

More Images tools

  • Passport Photo Maker — Crop a photo to passport and ID sizes and lay out a print-ready sheet of copies.
  • Favicon Generator — Make favicon.ico, PNG sizes, an Apple touch icon and a web manifest from an image, letters or an emoji.
  • GIF Maker — Turn a set of images into an animated GIF with frame delays, looping and a colour palette.
  • Meme Generator — Put top and bottom captions or free-placed text on any image and save it as PNG or JPEG.
  • Chart Maker — Turn pasted data into bar, line, area, pie and doughnut charts you can download as PNG or SVG.
  • HEIC to JPG Converter — Convert iPhone HEIC photos to JPG, PNG or WebP in your browser, in batches, and download them as a ZIP.
  • PNG to SVG Converter — Turn PNG, JPG and other bitmaps into scalable SVG vectors with adjustable colors and detail.
  • Fake Text Message Generator — Build a realistic text-message conversation mockup and save it as an image, for stories, tutorials and jokes.
  • Signature Generator — Draw or type a signature, pick ink and style, and download it as a transparent PNG or SVG.
  • Photo Collage Maker — Arrange photos in grid layouts with spacing, rounded corners and background color, then download the collage.
  • Image Optimizer — Re-encode and shrink images (JPEG/WebP/PNG), optionally resizing.
  • Image Format Converter — Convert images between PNG, JPEG and WebP entirely in your browser.

See all Images tools (40) · All tools