pngtowebp.org

How-to · 5 min read

How to batch convert PNG to WebP

Three battle-tested workflows: in-browser, the official cwebp CLI, and a one-line shell loop. Pick whichever matches your terminal comfort level.

Option 1: in your browser (no install)

The fastest path with zero setup. Open our PNG to WebP converter, drag a folder of PNGs onto the dropzone (multiple files are supported), pick a quality, and hit Download all as ZIP. Everything runs locally — no upload, nothing leaves your machine.

Good for: occasional batches up to a few hundred images, or anyone who would rather not install tooling.

Option 2: cwebp on Mac, Linux, Windows

cwebp is Google's official command-line WebP encoder. It's the gold standard for fidelity and gives you the most knobs to turn.

Install

Convert one file

cwebp -q 80 input.png -o output.webp

Lossless mode

cwebp -lossless input.png -o output.webp

Convert a whole folder (Bash / zsh)

for f in *.png; do
  cwebp -q 80 "$f" -o "${f%.png}.webp"
done

Convert a whole folder (PowerShell)

Get-ChildItem -Filter *.png | ForEach-Object {
  cwebp -q 80 $_.FullName -o ($_.BaseName + '.webp')
}

Recursive, in parallel

find . -type f -iname '*.png' | xargs -P 8 -I{} sh -c 'cwebp -q 80 "{}" -o "${1%.png}.webp"' _ {}

The -P 8 flag runs eight encodes in parallel — handy on a workstation with spare cores.

Option 3: ImageMagick

If you already have ImageMagick installed, no need to add another tool. ImageMagick can produce WebP, though it routes through a libwebp build under the hood:

magick mogrify -format webp -quality 80 *.png

mogrify writes new files alongside the originals — your PNGs stay where they are.

Choosing a quality

Sanity check after a batch

Run a quick before/after total — if you don't see ~50–70% size reduction on photos, double-check the input. Files like screenshots-of-line-art compress less than that:

du -sh *.png *.webp

For deeper context on what these wins translate to in real page loads, see the page-speed tests.

Related reading

Don't want to install anything?

Drag a folder of PNGs into our converter and download a ZIP.

Open the converter