2026-03-28

How to Compress an Image to Under 100KB (With Real Examples)

Four reliable ways to get an image under 100KB: resize-then-compress, WebP, a Python loop, and CLI tools, with measured file sizes from one real photograph.

How to Compress an Image to Under 100KB (With Real Examples)

Last updated: June 27, 2026

Getting an image under 100KB is a common requirement: form uploads with size caps, email attachments, app icons, and Google-hosted ad creatives all enforce byte limits. The trick is that quality compression alone rarely gets you there — you usually need to resize first and switch format. This guide shows four methods that work, with the real file sizes I measured on one 126 KB source photo.

Quick answer: how do you compress an image to under 100KB?

The most reliable order is: resize to the display size, then compress to WebP or JPEG. On the test photo, quality-only JPEG compression barely reached 94 KB (with visible loss), while resize-then-compress hit 66 KB and switching to WebP hit 38 KB — both under the target with less visible quality loss.

Method Result on a 126 KB source When to use
JPEG, lower quality only 94 KB (q60, lossy) Last resort; only if you cannot resize
Resize to 1200px + JPEG q70 66 KB Photos shown at display size
Resize + WebP 38 KB Web pages, best size/quality
Resize + AVIF ~30 KB Modern browsers only

If you just need it done once, use a browser tool. If you do it every week, learn one command or script. For the full format decision behind these numbers, see the AVIF vs WebP vs JPEG comparison.

Why quality-only compression is not enough

Most people open a compressor and drag the quality slider down until the file fits. That works, but it wastes quality budget. The source photo here is 1600×1067; shown at a typical 800px content width, the browser downloads 4× the pixels it displays.

Source 126 KB next to the under-100KB WebP result (38 KB): the target is reachable with little visible loss when you resize first

Measured across approaches, file size falls far more from resizing than from dropping quality:

Image compressed from 2.4 MB down to under 100 KB by resizing and exporting as quality-80 WebP

The takeaway: resize to the pixel dimensions you actually need before compressing. A 4000px photo compressed to JPEG q60 is still a 4000px download. This is also covered in the batch resize guide and the image compression deep dive.

Method 1: Browser compressor (one-off)

For a single image, use the Imagic AI Image Compressor:

  1. Upload the image.
  2. Resize to the display width (e.g. 1200px for a hero, 800px for content).
  3. Pick WebP or JPEG and lower quality to ~70.
  4. Check the reported size; download when it is under target.

This handles resize + format + quality in one pass. For precise visual control, Squoosh shows the exact output size and a live preview as you move the sliders — useful when a size cap is strict and you want to push quality as high as the limit allows.

Method 2: Convert to WebP (smallest result)

WebP is typically 25–30% smaller than JPEG at matched quality, so it is the easiest format for hitting a tight byte target. The same source that needed JPEG q60 to reach 94 KB reached 38 KB as WebP at q72 — smaller and higher quality.

## Resize to 1200px wide, encode WebP at quality 72
cwebp -q 72 -resize 1200 0 input.jpg -o output.webp

If you also need a JPEG fallback for old clients, wrap both in a <picture> element. See the TinyPNG alternatives guide for tools that output WebP and AVIF without a command line.

Method 3: Python loop to hit an exact target

When you need to guarantee a specific size (e.g. an upload cap), loop quality down until the file fits. This script resizes first, then steps quality down in increments:

from PIL import Image
from pathlib import Path

def compress_to_target(src: Path, dest: Path, target_kb: int = 100, max_width: int = 1200):
    """Resize then step JPEG quality down until under target_kb."""
    with Image.open(src) as img:
        if img.width > max_width:
            ratio = max_width / img.width
            img = img.resize((max_width, int(img.height * ratio)), Image.LANCZOS)
        quality = 85
        while quality >= 20:
            img.save(dest, "JPEG", quality=quality, optimize=True)
            if dest.stat().st_size <= target_kb * 1024:
                return dest.stat().st_size / 1024
            quality -= 5
    return dest.stat().st_size / 1024  # best effort

print(compress_to_target(Path("photo.jpg"), Path("photo-out.jpg"), target_kb=100))

Note the resize happens once, before the quality loop — recomputing the resize each iteration is both slower and slightly different each time. For WebP output, swap the save call to img.save(dest, "WebP", quality=quality).

Method 4: Command-line batch

For a folder of images, ImageMagick does it in one line per file. Write to an output folder so originals stay safe:

mkdir -p out
## Resize to 1200px, JPEG q70, strip metadata, write to out/
mogrify -path out -resize 1200x -quality 70 -strip *.jpg

## Or WebP for smaller files
mogrify -path out -resize 1200x -quality 72 *.jpg

For thousands of files, parallelize with xargs -P 4. This mirrors the workflow in the batch resize guide.

Which method should you pick?

Situation Method Why
One image, no install Browser compressor or Squoosh Fast, visual, no setup
Web page, smallest bytes Resize + WebP 38 KB vs 94 KB on the test photo
Strict upload cap Python target loop Guarantees the size
Recurring batch ImageMagick mogrify Scriptable, no upload

Common mistakes

  • Compressing without resizing. You give up quality for bytes you do not need. Resize first.
  • Stripping EXIF you need to keep. -strip removes camera metadata; keep it for photo archives, strip it for public web.
  • Re-encoding an already-compressed JPEG repeatedly. Each pass adds artifacts. Start from a master.
  • Forgetting to check the actual output size. Quality numbers are not sizes — verify the bytes after export.

Final pre-export checklist

  • Resize to the display width before lowering quality.
  • Export WebP first when the destination supports it.
  • Keep a JPEG fallback only when the upload form requires JPEG.
  • Check the final byte size after metadata stripping.
  • Open the compressed file at 100% before submitting it.

Frequently asked questions

Can every image be compressed to under 100KB?

No. A very large, detailed photo (say 6000×4000) may need aggressive resizing or visible quality loss to fit. If the source is huge, resizing down is mandatory, not optional.

Does compressing reduce quality?

Yes, lossy compression always removes information. But at matched quality, WebP and AVIF lose less than JPEG — so you can hit the byte target with less visible degradation by switching format instead of dropping quality further.

Should I resize or compress?

Both, in that order. Resize to the display dimensions first, then compress. Resizing alone often saves more bytes than any quality setting, as the chart above shows.

JPEG or WebP for a 100KB target?

WebP. It reaches the target at higher visual quality. Keep a JPEG fallback in a <picture> element for old clients. The image format guide covers the full trade-off.

How do I compress an image to under 100KB?

Resize to the display width first (the biggest byte saving), then convert to WebP and compress at quality 80. If still over 100KB, reduce the dimensions further. At the 100KB target, resizing is mandatory — quality-only compression of a large image rarely gets there. Match the resize width to the use case: thumbnails want 400–600px, content images 800–1200px.

Can a photo fit under 100KB?

Only at small dimensions. A full content photo (1200px+) will not fit cleanly under 100KB without heavy artifacting. 100KB suits thumbnails and avatars; for content photos, target 200KB or accept a larger file. Match the budget to the display size — small display, small file.

Does WebP beat JPEG at 100KB?

Yes — WebP is 25 to 35 percent smaller at equal quality, so it hits 100KB at higher quality than JPEG would. Use WebP for web delivery and keep JPEG only as a fallback, served through a <picture> element so the browser picks the right format.

Can I batch-compress to 100KB?

Yes, with a script that resizes each image to its display width, compresses, and loops the quality until each file lands under 100KB. A single quality setting will not hit 100KB across images of different dimensions — the resize-then-compress loop does, per file.

Does AVIF beat WebP at 100KB?

Often, yes — AVIF is roughly 50 percent smaller than JPEG and usually smaller than WebP too, so it can hit 100KB at higher quality. The trade-off is slower encoding and gaps on older browsers. Ship AVIF with a WebP and JPEG fallback through a <picture> element if your audience is mostly on modern browsers and you want the smallest files.

Close-up of a smartphone showing a coffee cup image on a screen outdoors.

Image credits

  • Compression-path comparison, before/after, and size-reduction chart — generated by the author from an ecommerce-style photograph (Pexels #16675632, photo by Mikael Blomkvist) to show real measured file sizes across compression methods.

Use the free tools while you follow the guide.