← All articles 6 min read

How to Compress WebP Images for Smaller File Sizes

WebP is already one of the most efficient image formats on the web. Google designed it that way. But "efficient" and "small enough" are different things — especially when you're serving thousands of product images, your CDN bill keeps climbing, or your Lighthouse performance score refuses to turn green.

The good news: you can compress WebP files further without destroying visual quality. Here are three methods, from zero-effort to full CLI control.

WebP Compression Basics: Lossy vs Lossless

Before compressing anything, know which type of WebP you're working with. Re-encoding a lossy WebP with lossy compression stacks generation loss. Re-encoding a lossless WebP with lossy compression is perfectly fine.

Lossy WebP Lossless WebP
How it works Discards data the eye is unlikely to notice Compresses without discarding any data
Typical file size (1920×1080 photo) 80–200 KB 400–900 KB
Best for Photos, complex images, hero banners Screenshots, diagrams, pixel art, transparency
Re-compression safe? No — each pass adds artifacts Yes — can re-encode without quality loss
Quality parameter 0–100 (lower = smaller, more artifacts) N/A (always bit-perfect)

If you're unsure which type you have, check the file size. A 1920×1080 photo under 300 KB is almost certainly lossy. Over 500 KB with sharp edges and flat colors? Likely lossless.

Method 1: Compress WebP with Pixotter

The fastest path. No installs, no CLI, no uploads to a server.

  1. Open Pixotter Compress
  2. Drag your WebP file onto the drop zone
  3. Adjust the quality slider (start at 75, go lower if the preview looks acceptable)
  4. Download the compressed file

Pixotter processes everything client-side using WebAssembly. Your images never leave the browser — no server round-trip, no privacy concerns, no file size limits imposed by an upload API.

For batch work, drop multiple WebP files at once. Pixotter compresses them in parallel and lets you download a zip.

Method 2: cwebp CLI Tool

For automation, build pipelines, or when you need precise control over encoding parameters, use Google's cwebp command-line tool from libwebp 1.4.0 (BSD-3-Clause license).

Lossy compression at quality 75 (a solid default):

cwebp -q 75 input.webp -o output.webp

Lossless compression (re-encode without quality loss):

cwebp -lossless input.webp -o output.webp

Lossy with advanced tuning (multi-pass optimization, stronger filtering):

cwebp -q 70 -m 6 -pass 10 -af input.webp -o output.webp

The -m 6 flag sets maximum compression effort (slower but smaller). The -pass 10 flag runs 10 optimization passes. The -af flag enables auto-filter for cleaner edges.

Install libwebp 1.4.0 on your system:

# macOS
brew install webp

# Ubuntu/Debian
sudo apt install webp

# Windows (via Chocolatey)
choco install webp

Method 3: Convert to AVIF (Even Smaller)

If you need the absolute smallest file size and your audience's browsers support it (96%+ of users as of early 2026), converting WebP to AVIF typically saves another 20–30% at equivalent visual quality.

Use Pixotter Convert to convert WebP → AVIF in one step, or read the full comparison in our WebP vs AVIF breakdown.

AVIF encoding is slower than WebP, so it's better suited for static assets you encode once and serve many times — not for on-the-fly processing.

Quality vs File Size: What to Expect

These numbers are based on a typical 1920×1080 photograph encoded with cwebp from a lossless PNG source. Your results will vary with image content, but the ratios hold.

WebP Quality Typical File Size Size vs q95 Visual Impact
95 ~320 KB Baseline Virtually indistinguishable from original
85 ~180 KB 56% Minimal artifacts, safe for hero images
75 ~120 KB 38% Slight softening, excellent for most web use
65 ~85 KB 27% Noticeable softening on zoom, fine at display size
50 ~55 KB 17% Visible artifacts in gradients, acceptable for thumbnails

The sweet spot for most web images is quality 70–80. Below 60, artifacts become visible at display size in photos with smooth gradients (skies, skin tones). Above 85, you're paying a lot of bytes for imperceptible quality gains.

When NOT to Compress Further

Resist the urge to re-compress every WebP file you find. Two scenarios where further compression does more harm than good:

Already-lossy WebP at q75 or lower. Re-encoding a lossy image with lossy compression stacks generation loss — each pass introduces new artifacts on top of existing ones. The file might shrink 10%, but the visual quality drops disproportionately. If the source is lossy WebP at reasonable quality, leave it alone or convert to AVIF instead.

Tiny images. A 100×100 thumbnail that's already 4 KB won't benefit from compression. The HTTP overhead of the request itself likely exceeds any savings. Focus your compression effort on images above 50 KB.

Lossless WebP Optimization

If you have lossless WebP files (screenshots, diagrams, UI captures), you can reduce their size without any quality loss:

Strip metadata. WebP files can contain EXIF, XMP, and ICC profile data. Remove it:

cwebp -lossless -metadata none input.webp -o output.webp

Maximize encoding effort. The -m 6 -z 9 flags tell the encoder to spend more CPU time finding better compression:

cwebp -lossless -m 6 -z 9 -metadata none input.webp -o output.webp

This can take significantly longer but typically shaves 5–15% off lossless WebP files. Worth it for images served millions of times.

Batch Compression

Pixotter Batch

Drag an entire folder of WebP files onto Pixotter Compress. All files process in parallel in your browser. Download the batch as a zip. No file count limit — the constraint is your device's memory.

Shell Loop with cwebp

Compress every WebP file in a directory:

for f in *.webp; do
  cwebp -q 75 -m 6 "$f" -o "compressed/$f"
done

Create the compressed/ directory first. For recursive processing across subdirectories:

find . -name "*.webp" -exec sh -c '
  mkdir -p "compressed/$(dirname "{}")"
  cwebp -q 75 -m 6 "{}" -o "compressed/{}"
' \;

FAQ

Is WebP already compressed?

Yes. WebP uses either lossy compression (similar to JPEG's DCT approach but more efficient) or lossless compression (a predictor-based scheme). But the degree of compression varies — a lossless WebP exported from Photoshop has plenty of room for further optimization.

What quality setting should I use for WebP?

Start at 75 for photos. Check the output visually. If it looks good, try 70. If you see artifacts in gradients or smooth areas, bump back up to 80. For thumbnails under 400px, you can go as low as 60.

Can I compress WebP without losing quality?

Yes — if your source is lossless WebP. Re-encode with cwebp -lossless -m 6 -z 9 -metadata none to optimize the encoding and strip metadata. The output will be bit-for-bit identical in pixel data. For lossy WebP, any re-encoding introduces additional quality loss.

How much smaller is WebP compared to PNG?

Lossless WebP is typically 25–35% smaller than PNG. Lossy WebP at quality 75 is typically 70–80% smaller than the equivalent PNG. See our full PNG vs WebP comparison for detailed benchmarks.

Should I convert WebP to AVIF instead of compressing?

If your priority is minimum file size and your target browsers support AVIF, yes — AVIF delivers 20–30% smaller files at equivalent visual quality. The trade-off is slower encoding and slightly less browser support. For build pipelines where encoding time doesn't matter, AVIF is the better choice.

Does compressing WebP affect transparency?

No. Both lossy and lossless WebP support alpha channels, and compression preserves transparency. Lossy compression may introduce slight artifacts at transparency edges, but the alpha channel itself remains intact.

How do I check if a WebP file is lossy or lossless?

Use webpinfo (included with libwebp 1.4.0):

webpinfo input.webp

Look for the Format line — it will say either Lossy or Lossless.

What's the difference between WebP compression and GIF compression?

WebP supports both photos and animations with far better compression than GIF. An animated WebP is typically 40–60% smaller than the equivalent GIF. For static images, there's no comparison — GIF is limited to 256 colors. See our GIF compression guide for more on optimizing GIF files specifically.

For more on WebP's place in the format landscape, read what is WebP or learn about lossy vs lossless compression to make smarter encoding decisions.