🎯 WebP is the future — smaller size, better quality, faster websites.
In this quick guide, you'll learn how to installcwebp
on Windows and batch convert.png
images to.webp
using just PowerShell.
🛠 Step 1: Download WebP Tools for Windows
Download the latest pre-built binaries from Google's official storage:
👉 https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html
Choose the zip file matching your system, like:
libwebp-1.3.2-windows-x64.zip
📂 Step 2: Extract the ZIP and Set the PATH
- Extract the ZIP to a location like:
C:\www\test\libwebp-build
- Inside the folder, you'll find:
C:\www\test\libwebp-build\bin\cwebp.exe
- Now add this path to your system's
Environment Variables
: - Search for
Environment Variables
in Windows Start - Edit the System
Path
variable - Add:
C:\www\test\libwebp-build\bin
- Restart VS Code or your terminal
✅ Step 3: Verify the Installation
Open your terminal and run:
cwebp -version
Output should look something like:
1.6.0
libsharpyuv: 0.4.2
🔄 Step 4: Convert All .png
Files to .webp
in a Folder
Navigate to the folder where your .png
files are. For example:
cd C:\www\wsus\dir_name\public\website\images
Then run this one-liner in PowerShell:
Get-ChildItem -Filter *.png | ForEach-Object {
$out = "$($_.DirectoryName)\$($_.BaseName).webp"
cwebp $_.FullName -q 85 -o $out
}
✅ This will:
- Convert every
.png
file in the folder to.webp
- Use 85% quality
- Output the
.webp
file in the same folder
📁 (Optional) Output to a Subfolder
Want to keep .webp
files separate? Use this:
$outputFolder = "webp_output"
New-Item -ItemType Directory -Force -Path $outputFolder
Get-ChildItem -Filter *.png | ForEach-Object {
$out = Join-Path -Path $outputFolder -ChildPath "$($_.BaseName).webp"
cwebp $_.FullName -q 85 -o $out
}
🧪 Extra: Check if cwebp
is recognized
where cwebp
If the command returns a valid path, you’re good. Otherwise, check your PATH again.
🛠 If It Doesn't Work in PowerShell 7
Sometimes PowerShell 7 (pwsh) doesn't refresh your PATH immediately.
Solution: add it manually to your PowerShell profile:
notepad $PROFILE
Then add this line:
$env:Path += ";C:\www\test\libwebp-build\bin"
Save and restart terminal.
🎉 Done!
You just built a zero-GUI image optimization workflow on Windows.
You’re now officially in the WebP club 😎
If this helped you — leave a ❤️, bookmark it, or share with a fellow dev!