How to compress an image to a target file size

Image compression reduces the number of bytes needed to store a photo or graphic so it uploads faster, loads quicker on the web, and fits platform limits. Our free online image compressor accepts JPG, PNG, WebP, GIF, AVIF, BMP, TIFF, ICO, and HEIC/HEIF as input, and outputs JPG, PNG, WebP, or AVIF (plus Original and Auto/smallest). Defaults to Auto — a balanced squeeze that shrinks files without a noticeable quality drop. Prefer full control? Dial a quality slider or set an explicit target size in KB. Compression runs in your browser via WASM codecs (MozJPEG, libimagequant, libwebp, libavif, oxipng) — pixels do not leave your device for a normal compress. A secure, reCAPTCHA-protected server fallback is used only if your browser cannot encode a format. Save to history uploads the original and result and stores them for 7 days. No account is required to compress or download.

Follow these steps to compress one image or a whole batch:

  1. Add your images. Click Select images or drag and drop files onto the upload area. You can add up to 20 images at once. Each file can be up to 20 MB. Supported inputs: JPG, PNG, WebP, GIF, AVIF, BMP, TIFF, ICO, or HEIC/HEIF. Adding files does not upload them.
  2. Choose a compression mode. Use the mode toggle in the toolbar:
    • Auto — default. Binary-searches quality and stops at the lowest setting that still clears an SSIM perceptual floor (runs in your browser; no upload required when WASM codecs load). PNG Auto uses libimagequant palette reduction plus oxipng. Dimensions stay the same.
    • Quality — drag the slider to trade sharpness for bytes. Lower values produce smaller files. 80% is a strong starting point for web photos.
    • Target size — set an explicit KB budget (presets for 100 KB, 200 KB, 500 KB, and 1 MB, or type your own). We binary-search quality to stay under the limit, and optionally downscale dimensions if quality alone cannot hit the budget.
  3. Pick an output format. Outputs are JPG, PNG, WebP, or AVIF. Original (default) keeps JPG, PNG, WebP, or AVIF as uploaded — GIF/BMP/TIFF/ICO prefer PNG; HEIC/HEIF prefers JPG. Auto (smallest) races the available encoders and keeps the leanest result. Browser encodes use MozJPEG, libimagequant + oxipng, libwebp, and libavif when available.
  4. Remove metadata (optional). Tick Remove metadata to strip EXIF, GPS, camera, and lens tags. This protects privacy and can trim a few extra kilobytes.
  5. Allow downscale (target mode). When enabled, if the image still exceeds your KB target at the lowest useful quality, we reduce pixel dimensions in small steps until it fits — prioritising the smallest file that meets the limit.
  6. Compress. Click Compress all. Work stays on your device unless a browser encoder fails (rare reCAPTCHA-protected server fallback). Progress is shown per item; failures are isolated so the rest of the queue continues. Each finished row shows a savings bar with the new size and percent smaller.
  7. Download or save. Download individual files or zip the whole queue with Download all (stays on your device). Save to history uploads the original and result for 7 days so you can re-open settings and compress again later.

Common upload size targets

Many platforms reject oversized images. Aiming for a concrete KB limit up front avoids failed uploads and re-exports:

  • Under 100 KB — favicons, tiny UI assets, email signatures, and thumbnail grids.
  • Under 200–500 KB — typical product photos, blog heroes on mobile, and CMS media libraries with hard caps.
  • Under 1 MB — high-detail web photos where you still want snappy loads without aggressive cropping.
  • Form / portal limits — government, university, and job portals often specify exact maxima (for example 300 KB or 2 MB). Enter that number in Target KB and compress once.

When image compression helps most

  • Website performance. Smaller images improve Largest Contentful Paint and reduce data use for visitors on mobile networks.
  • Ecommerce catalogues. Batch-compress product shots so gallery pages stay light without re-shooting.
  • Email and chat attachments. Shrink PNGs and camera JPGs before attaching so messages clear size filters.
  • Social scheduling tools. Meet Instagram, LinkedIn, or ad-manager limits without opening a desktop editor.
  • Privacy-conscious sharing. Strip GPS and camera metadata before posting photos taken on a phone.

How this compressor finds the smallest file

Lossy formats (JPG, WebP, AVIF) discard imperceptible detail to shrink files. PNG Auto uses libimagequant palette quantization (the same class of algorithm as TinyPNG/pngquant) plus oxipng, with an SSIM stop so it stays visually close to the original. We prefer browser WASM codecs first: MozJPEG, libwebp, libavif, libimagequant, and oxipng. Auto mode binary-searches quality against an SSIM score of the original vs the compressed result, and keeps the smallest encode that still clears a “looks the same” threshold — so you get a small file without chasing artefacts. For a target size we binary-search quality, then scale dimensions only if you allow downscale and the budget still cannot be met. Format Auto (smallest) compares browser encoder candidates and keeps the leanest successful encode; a secure server path is only a fallback when the browser cannot finish the job.

Lossless PNG sources are excellent for graphics with flat colour, but photographs almost always compress far smaller as WebP or AVIF. If you need a different container rather than a size budget, use the Image converter instead.