Compress WebP: How to Shrink WebP Files Without Losing Quality (2026)
Compress WebP: How to Shrink WebP Files Without Losing Quality (2026)
WebP is the format that finally fixed the JPG-vs-PNG split. It does lossy compression like JPG (typically 25-35% smaller at the same quality) and lossless compression like PNG (typically 26% smaller than PNG) in a single container, with full alpha transparency and animation support. Every modern browser has decoded WebP since 2020, and as of 2026 it is the de-facto format for new web assets.
The catch: most WebP files in the wild are already encoded once and then never re-optimized. A WebP exported from Photoshop or generated by an image CDN at default settings is rarely the smallest it could be. This guide is about how to compress WebP files further — both new ones from source and existing WebPs that need to shrink.
Lossy WebP vs lossless WebP
WebP is two encoders sharing one container. Picking the right one is the most important decision you make.
Lossy WebP uses VP8 prediction-based encoding (the still-image cousin of the VP8 video codec). It is 25-35% smaller than JPG at the same perceptual quality, supports alpha, and is what almost every photographic image should use.
Lossless WebP uses a different algorithm — a custom dictionary-based scheme with color cache, transform predictors, and entropy coding. It is typically 26% smaller than PNG, supports alpha natively, and is the right choice for screenshots, UI elements, line art, logos, and any image where every pixel matters.
The encoder picks based on the input format and the flags you pass:
# Lossy (default) at quality 80
cwebp -q 80 input.png -o output.webp
# Lossless
cwebp -lossless input.png -o output.webp
# Near-lossless (smaller than lossless, almost no perceptual loss)
cwebp -near_lossless 60 input.png -o output.webp
Rule of thumb: photos → lossy at quality 75-85. Screenshots, UI, logos, line art → lossless or near-lossless 80. The wrong choice can swing file size by 5-10x.
For format comparisons see JPEG vs PNG and AVIF vs WebP.
Quality settings that actually matter
WebP's lossy quality scale runs 0-100, just like JPG. The mapping:
| Quality | Use case | Reduction vs source PNG/JPG |
|---|---|---|
| 95 | Print archive | ~30% |
| 85 | Hero images, hi-res | ~50% |
| 80 | Web default | ~65% |
| 75 | Social uploads | ~75% |
| 70 | ~80% | |
| 60 | Thumbnails | ~85-90% |
Quality 80 is the WebP sweet spot for almost everything. Below 60, blocking artifacts show in flat regions (skies, gradients). Above 90, you're bloating files for no perceptible gain.
Beyond quality, the -m flag controls method (encoding effort) on a 0-6 scale. Higher means slower encoding but smaller output:
cwebp -q 80 -m 6 input.png -o output.webp
Method 6 is ~10-20% slower than the default (method 4) and ~3-5% smaller. For one-off encodes it's worth it. For batch jobs of thousands of images, the default is fine.
Method 1: Compresto (native macOS, batch)
Compresto supports WebP as both an input and output format with hardware-aware encoding on Apple Silicon.
Drag any image — JPG, PNG, HEIC, RAW — and pick Format → WebP. Three presets:
- Web — Lossy quality 80, method 4, strips metadata, retains color profile. Output is browser-ready.
- Lossless — Lossless mode for screenshots and line art. Auto-detects when lossy would be a bad call.
- Email — Quality 70, max width 1920px. Aggressive but readable.
Why use Compresto for WebP specifically:
- Native batch — drag 500 images, get 500 WebPs. No upload, no quotas.
- Smart format conversion — converts existing WebP → smaller WebP by re-encoding through the source.
- Format chain — JPG → resize → strip EXIF → encode WebP, all in one pipeline.
- Metadata control — strip or retain EXIF on output. See remove EXIF data for context on why this matters.
Download Compresto for batch WebP encoding on Mac. Free tier handles unlimited batch sizes.
Method 2: cwebp (command line, the canonical tool)
cwebp is Google's reference encoder. Every WebP encoder you use is either a wrapper around it or a re-implementation of the same VP8L/VP8 specs.
Install on Mac:
brew install webp
Install on Windows: download the libwebp precompiled binary from Google's WebP downloads page, unzip, add to PATH.
Common recipes:
Lossy quality 80 (web default):
cwebp -q 80 -m 6 input.jpg -o output.webp
Lossless:
cwebp -lossless -m 6 input.png -o output.webp
Near-lossless (best size for "looks identical"):
cwebp -near_lossless 60 -q 100 input.png -o output.webp
The -near_lossless flag is one of WebP's underrated features. It sacrifices a tiny amount of pixel exactness — completely invisible to the eye — for ~30-50% smaller files than true lossless on most images.
Strip metadata while encoding:
cwebp -q 80 -metadata none input.jpg -o output.webp
Resize while encoding:
cwebp -q 80 -resize 1920 0 input.jpg -o output.webp
The 0 for height tells cwebp to auto-calculate to preserve aspect ratio.
Batch a folder:
for f in *.jpg; do
cwebp -q 80 -m 6 "$f" -o "${f%.jpg}.webp"
done
Method 3: Squoosh (in-browser, quality tuning)
Squoosh is Google's open-source image compressor. It runs the WebP encoder in your browser via WebAssembly — your image never leaves your device.
Squoosh is the best free way to find the right WebP quality for a hero image. The split-pane UI shows source on the left and encoded WebP on the right at the same zoom. Drag the quality slider and watch artifacts appear in real time. Once you find the lowest quality that still looks clean, that's your batch target.
Limitations: one image at a time. Squoosh is for tuning, not batch. Use it to find the right quality, then apply that quality across hundreds of images in Compresto, ImageMagick, or a CI pipeline.
Method 4: ImageMagick / vips (CLI, scriptable)
For build pipelines and large media libraries, ImageMagick and libvips both support WebP.
ImageMagick:
magick input.jpg -quality 80 -define webp:method=6 output.webp
libvips (typically 2-5x faster than ImageMagick on large files):
vips webpsave input.jpg output.webp[Q=80,effort=6]
For a 100,000-image library, libvips is the right tool. ImageMagick is fine for smaller batches and is more universally installed.
Method 5: Online WebP compressors
For one-offs without installing software:
- TinyPNG / TinyJPG (tinypng.com, tinyjpg.com) — both encode to WebP with smart quantization. Up to 20 images per batch on free tier, 5 MB max each.
- Squoosh (squoosh.app) — browser-only, in-browser processing.
- ImageKit (imagekit.io/tools/compress-webp) — fast, ad-free, works in-browser.
- Compress-or-die (compress-or-die.com/webp) — pixel-by-pixel control with diff comparison.
- Cloudinary — free tier with API access.
- Adobe Express — free for small jobs, requires sign-in.
Privacy: if the tool says "in-browser" or "WebAssembly", processing is local. Otherwise, your image is uploaded to a server. Fine for blog images, not fine for client work, medical, or legal.
Method 6: Image CDN with auto-WebP
If you serve images from a CDN, the right answer is often "let the CDN do it." Modern image CDNs (Cloudflare Images, Imagix, Cloudinary, KeyCDN, Vercel Image Optimization) detect WebP support via the Accept header and serve WebP automatically — falling back to JPG for older clients.
This is the right path for high-traffic sites because:
- You upload one source image, get optimized variants for every viewport.
- The CDN re-encodes whenever encoder defaults change without you touching anything.
- AVIF is automatically served to clients that support it (better compression than WebP), with WebP as the fallback to older browsers.
For Next.js sites (compresto.app uses this), the built-in next/image component does WebP/AVIF negotiation automatically — see image optimization for web for the broader picture.
Animated WebP
WebP supports animation. It is a viable replacement for animated GIF:
- 25-50% smaller than the equivalent GIF at the same quality.
- Full color (24-bit) instead of GIF's 256-color palette.
- Supports lossy and lossless animation.
To create animated WebP from a GIF:
gif2webp -q 80 -m 6 input.gif -o output.webp
To compress an existing animated WebP:
webpinfo input.webp # inspect
cwebp does not handle animation; use img2webp for re-encoding.
For animated GIF compression specifically, see reduce GIF size, compress GIF online, and our Mac GIF compressor.
When NOT to use WebP
WebP isn't universally the right answer:
- Print workflows — Print software usually wants TIFF, PSD, or high-quality JPG. WebP is rare in print.
- Long-term archives — Lossless TIFF or DNG remains the safer choice for archiving original captures. WebP is fine for derivatives.
- Client deliverables — A client expecting "the photos" wants JPG. Send WebP to web teams, JPG/RAW to clients.
- Older email clients — Outlook 2019 and older may not preview WebP inline. Send JPG for email.
For most other web-bound use cases, WebP wins.
WebP vs AVIF in 2026
AVIF is the next-generation challenger:
- AVIF is ~50% smaller than JPG, vs WebP's 25-35%.
- AVIF encode is ~10x slower than WebP in software (faster on hardware-accelerated chips).
- AVIF decode is fast in every modern browser.
Use AVIF when encode time is paid once and decode happens millions of times (web archives, image CDN sources). Use WebP when you encode often, batch-encode, or need maximum compatibility with older mid-2020s browsers. Detailed comparison in AVIF vs WebP.
Combining WebP with other optimizations
The full publish-ready pipeline for a web image:
- Resize to display dimensions.
- Strip metadata — see remove EXIF data and remove metadata from photo.
- Encode to WebP at quality 80 (or AVIF at quality 60).
- Verify with an EXIF viewer that no metadata leaked through.
In Compresto, all four steps run in one drag-and-drop. For CI pipelines, the chained CLI:
exiftool -all= source.jpg
magick source.jpg -resize 1920x -quality 80 -define webp:method=6 output.webp
For non-WebP equivalents, see compress JPG, compress PNG, and compress MP4 for video.
FAQ
Is WebP smaller than JPG? At equivalent quality, lossy WebP is 25-35% smaller than JPG on photographic content. The reduction is largest on images with smooth gradients (skies, skin) and smallest on already-noisy content (foliage, fabric textures).
Can I compress an existing WebP further? Yes — re-encode at a lower quality. But every re-encode loses some data. If you have the source (PNG, JPG, RAW), encode once from the source rather than re-encoding the WebP. Compresto and ImageMagick both let you re-encode WebP → smaller WebP if no source is available.
Does WebP support transparency? Yes — both lossy and lossless WebP modes support full alpha. This is one of WebP's biggest wins over JPG (no alpha) and arguably over PNG (PNG alpha is large; WebP alpha is small).
Why is my WebP larger than the source JPG?
Three causes: (1) you used lossless WebP on a photographic source — switch to lossy, (2) you used quality 95+ which is near-lossless and bigger than typical JPG, (3) the source JPG was already heavily compressed and re-encoding to WebP at high quality bloated it. Use lossy WebP at quality 80 with -m 6 for the smallest typical output.
Can WebP replace PNG? For UI elements, screenshots, line art, and icons — yes. Use lossless WebP. Slightly smaller than optimized PNG, with the same exact-pixel guarantee. PNG remains useful for compatibility with older tools that don't read WebP.
Does Safari support WebP? Yes, since Safari 14 (Big Sur, 2020). Every modern browser handles WebP. The only systems that fail to decode WebP in 2026 are pre-2020 builds of older browsers.
How do I view WebP files? Every modern browser renders WebP natively. macOS Preview supports WebP since macOS Monterey. Windows Photos app supports WebP since Windows 11. For older systems, drag into the browser or convert to JPG/PNG with convert WebP to JPG or convert WebP to PNG.
TL;DR
- Photos: lossy WebP at quality 80, method 6. ~25-35% smaller than equivalent JPG.
- Screenshots, UI, line art: lossless WebP, or near-lossless 60.
- Mac: Compresto for batch, Squoosh for tuning,
cwebpfor scripting. - Windows / Linux:
cwebpfrom Google's libwebp, or ImageMagick/vips for pipelines. - CI:
cwebp -q 80 -m 6is the canonical recipe. - CDN: let Cloudflare Images, Vercel, or Cloudinary handle WebP/AVIF negotiation automatically.
- Always strip metadata before publishing — see remove EXIF data.
WebP is the right format for almost every web image in 2026. Encode it correctly and it stays right.