Skip to content

Convert JPG to WebP Free on Windows Using WSL

Convert JPG to WebP free on Windows with WSL and cwebp. One command per file, a batch loop for whole folders, and no uploads — your images never leave your PC.

MGMCSA Guru Team June 8, 2026 6 min read
A WSL terminal running cwebp to convert a JPG file into a smaller WebP file on Windows

Most “convert JPG to WebP” results send you to a website where you upload your photo, wait, and download the result. That’s fine for one throwaway image. It’s a bad idea for anything private — client photos, screenshots of internal tools, family pictures — because the file leaves your machine and lands on someone else’s server.

There’s a cleaner way that’s free, works offline, and handles one file or ten thousand: run Google’s own cwebp tool inside WSL. It’s the same encoder behind most WebP conversions, it installs in seconds, and nothing you convert ever gets uploaded anywhere.

This guide covers the install, the single-file command, and a batch loop for a whole folder. If you don’t have WSL yet, set it up first with our WSL install guide — it’s one command and a reboot.

Why cwebp instead of an online converter

cwebp is the command-line encoder from Google’s WebP project. It takes a JPG (or PNG, TIFF) and writes a .webp file, with direct control over quality and compression. Three things make it worth the small setup:

  • Nothing is uploaded. The conversion happens on your own disk. For confidential or work files, that alone settles the question.
  • It batches. One short loop converts an entire folder. No dragging files in one at a time, no per-file upload limits.
  • It’s free with no catch. No watermarks, no “sign up to download,” no daily cap.

The trade-off is a one-time setup and typing a command instead of clicking. Once it’s in place, converting is faster than any website.

Before you start

  • WSL installed with a Linux distro (Ubuntu is fine)
  • Your JPG files accessible from WSL
  • A few minutes for the one-time install

Install cwebp in WSL

cwebp ships in the webp package. Open your WSL terminal (type wsl in Windows Terminal) and install it:

sudo apt update && sudo apt install -y webp

Confirm it’s there:

cwebp -version

You’ll get a version number back. That’s the whole setup — the encoder is now available for any folder you point it at.

Convert a single JPG to WebP

The basic command takes an input file, a quality value, and an output name:

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

That’s it. input.jpg becomes output.webp in the same folder. The -q value (0–100) controls lossy quality: higher keeps more detail and makes a bigger file. For photos, 80 is a sensible default — close to the original, with a real size drop.

To find your JPGs, remember that your Windows drives are mounted under /mnt. A file on your desktop is reachable like this:

cd /mnt/c/Users/YourName/Pictures
cwebp -q 80 photo.jpg -o photo.webp

Check the result against the original:

ls -lh photo.jpg photo.webp

Batch convert a whole folder

This is where the command line pulls ahead of any website. To convert every JPG in the current folder and write a matching .webp next to each one, use a short loop:

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

What it does, line by line:

  • for f in *.jpg walks every .jpg in the folder.
  • "$f" quotes the filename so spaces don’t break it.
  • "${f%.jpg}.webp" strips the .jpg and adds .webp, so beach.jpg becomes beach.webp.

Your original JPGs are left untouched — you end up with both files. To also catch uppercase .JPG and .jpeg, widen the pattern:

for f in *.jpg *.JPG *.jpeg; do [ -e "$f" ] && cwebp -q 80 "$f" -o "${f%.*}.webp"; done

The [ -e "$f" ] check skips a pattern that matches nothing, so you don’t get an error when, say, there are no .jpeg files.

Tuning quality and size

-q is the dial you’ll reach for most. A few practical points:

  • Photos: stay in lossy mode. -q 80 is the default to beat; try -q 75 if you want smaller, -q 90 if you’re keeping fine detail.
  • Graphics, logos, screenshots: use lossless instead. Lossy compression smears sharp edges and flat color, while lossless keeps them crisp:
cwebp -lossless input.png -o output.webp
  • Squeeze a bit more out of lossy files with -m 6 (slowest, best compression method) and -mt for multithreading:
cwebp -q 80 -m 6 -mt input.jpg -o output.webp

cwebp options you'll actually use

-q <0-100> Lossy quality; 80 is a good photo default
-lossless Lossless mode for graphics/screenshots
-m <0-6> Compression effort; 6 is smallest but slowest
-mt Use multiple threads
-resize <w> <h> Resize while converting (0 keeps aspect)
-o <file> Output WebP filename

You can even resize during conversion, which is handy for web images you don’t need at full resolution:

cwebp -q 80 -resize 1600 0 input.jpg -o output.webp

The 0 for height tells cwebp to keep the aspect ratio. If you need to resize a lot of images as a separate step, see our guide on batch resizing images from the command line.

Going the other way, and other formats

This same toolchain handles related jobs. To turn WebP files back into JPG or PNG, see convert WebP to JPG or PNG. If your source images are PNGs rather than JPGs, the approach barely changes — there’s a dedicated walkthrough in bulk convert PNG to WebP, including when lossless is the better choice.

Wrapping up

Converting JPG to WebP doesn’t need a website or a paid app. cwebp inside WSL does it for free, offline, and in bulk: cwebp -q 80 input.jpg -o output.webp for one file, a short for loop for a whole folder. Because it runs locally, nothing you convert is ever uploaded — which makes it the safer choice for anything you wouldn’t want sitting on a stranger’s server.

Install it once, keep the loop handy, and folder-sized conversions become a single line you can rerun any time.

Frequently asked questions

Do my images get uploaded anywhere when I convert them this way?

No. cwebp runs locally inside WSL on your own machine, so the JPG and the WebP file both stay on your disk. Nothing is uploaded to a website, which is the main reason to use this instead of an online converter for anything private or work-related.

What quality value should I use with cwebp?

For photos, -q 80 is a good default — visually close to the original at a much smaller size. Drop to -q 75 if you need smaller files, or go up to -q 90 for images where detail matters. The right number depends on the image, so convert a few test files and compare.

Is WebP smaller than JPG at the same quality?

Usually yes. For typical photos, WebP at a similar visual quality is often noticeably smaller than the equivalent JPG, which is why it's common for web images. The exact saving varies per image, so check the output sizes rather than assuming a fixed percentage.

Can I convert a whole folder of JPGs at once?

Yes. Use a short bash for-loop that runs cwebp on every .jpg in the folder and writes a matching .webp next to it. The loop in this guide does exactly that and leaves your originals untouched.

Should I use lossless mode for photos?

No. Lossless WebP is meant for graphics, screenshots, and images with flat color or sharp edges. For photographs, lossy mode with -q gives much smaller files at no visible cost, so keep -lossless for non-photo images.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.