How to Convert PNG to WebP Using ImageMagick on Windows (And Why You Should)
2/17/2026

If you've been serving PNG images on your website, you're likely leaving a significant amount of performance on the table. WebP is a modern image format that offers dramatically smaller file sizes without sacrificing quality — and converting your images on Windows is easier than you think with ImageMagick.
In this guide, we'll cover why WebP matters, how to install ImageMagick, and how to convert your PNG files — one at a time or in bulk.
Why WebP? The Case for Switching
Before jumping into the how-to, it's worth understanding why WebP has become the go-to format for the modern web.
Smaller File Sizes
WebP typically produces files 25–35% smaller than PNG and 25–34% smaller than JPEG at equivalent visual quality. For image-heavy websites, this translates directly into faster load times and lower bandwidth costs.
Lossless and Lossy Support
Unlike JPEG (lossy only) or PNG (lossless only), WebP supports both compression modes. You can use lossy WebP for photos and lossy graphics, and lossless WebP for icons, screenshots, or anything that needs pixel-perfect fidelity — all within the same format.
Transparency Support
PNG is popular largely because it supports transparent backgrounds (alpha channel). WebP supports transparency too, even in lossy mode. This makes it a genuine replacement for PNG in every scenario, not just photos.
Animation Support
WebP also supports animated images, making it a more efficient alternative to GIF as well.
Browser Support
As of today, WebP is supported by all major modern browsers — Chrome, Firefox, Edge, Safari (since version 14), and Opera. If you're building for the web, there's no longer a compatibility reason to avoid it.
SEO and Core Web Vitals
Google's Core Web Vitals metrics measure page performance, and image size is a major factor. Serving WebP images can noticeably improve your Largest Contentful Paint (LCP) score, which directly impacts your SEO ranking.
Step 1: Install ImageMagick on Windows
ImageMagick is a free, open-source tool for image conversion and manipulation. It supports dozens of formats including PNG, JPEG, WebP, GIF, and more.
Download the installer from the official website: 👉 https://imagemagick.org/script/download.php#windows
Choose the latest stable Windows installer (typically a .exe file). During installation:
- Check "Add application directory to your system path" — this lets you run magick from any folder in the terminal.
- Leave the other default options as-is unless you have a specific need.
Once installation is complete, open PowerShell or Command Prompt and verify it works:
magick --version
You should see output like:
Version: ImageMagick 7.x.x-x ...
If you see that, you're good to go.
Step 2: Convert a Single PNG to WebP
Navigate to the folder containing your image, or use the full file path. The basic syntax is:
magick input.png output.webp
Example
magick hero-image.png hero-image.webp
This performs a lossless conversion by default when the source is PNG. The output file will be a high-quality WebP.
Control Quality (Lossy Compression)
To produce a smaller file using lossy compression, add the -quality flag. The value ranges from 0 (worst) to 100 (best), with 80 being a good default for most web images:
magick input.png -quality 80 output.webp
A quality of 75–85 is generally the sweet spot — visually indistinguishable from the original PNG but significantly smaller in file size.
Force Lossless WebP
If you need a pixel-perfect lossless output (for logos, screenshots, UI assets), use:
magick input.png -define webp:lossless=true output.webp
Step 3: Convert Multiple PNGs in Bulk
Converting files one by one isn't practical for large projects. PowerShell makes it easy to batch convert an entire folder.
Convert All PNGs in the Current Folder
Get-ChildItem -Filter *.png | ForEach-Object {
magick $_.FullName -quality 80 ($_.BaseName + ".webp")
}
This loops through every .png file in the current directory and creates a .webp version alongside it with the same base name.
Convert PNGs in a Folder and Save to a Different Output Folder
$input = "C:\images\originals"
$output = "C:\images\webp"
New-Item -ItemType Directory -Force -Path $output | Out-Null
Get-ChildItem -Path $input -Filter *.png | ForEach-Object {
$outFile = Join-Path $output ($_.BaseName + ".webp")
magick $_.FullName -quality 80 $outFile
Write-Host "Converted: $($_.Name) → $($_.BaseName).webp"
}
This is cleaner for production use — it keeps your originals untouched and puts all WebP files in a separate folder.
Recursive Conversion (Including Subfolders)
Get-ChildItem -Path "C:\images" -Filter *.png -Recurse | ForEach-Object {
$outFile = [System.IO.Path]::ChangeExtension($_.FullName, ".webp")
magick $_.FullName -quality 80 $outFile
Write-Host "Done: $($_.Name)"
}
Step 4: Resize and Convert at the Same Time
ImageMagick can resize and convert in a single command, which is great for generating optimized thumbnails or responsive image sets.
# Resize to max 800px wide while preserving aspect ratio, then convert magick input.png -resize 800x -quality 80 output.webp # Resize to exact dimensions (may distort) magick input.png -resize 800x600! -quality 80 output.webp # Resize to fit within a box (no cropping) magick input.png -resize 800x600 -quality 80 output.webp
Checking the Results
After converting, compare file sizes to confirm the savings:
Get-ChildItem *.png, *.webp | Select-Object Name, @{Name="Size (KB)"; Expression={[math]::Round($_.Length / 1KB, 1)}} | Sort-Object Name
You'll typically see the WebP files at roughly half the size of their PNG counterparts.
Tips and Best Practices
Keep your originals. Always work from the original PNG files. WebP (especially lossy) is a delivery format — don't throw away your source images.
Use quality 75–85 for most cases. Going below 70 can produce visible compression artifacts. Above 85 gives diminishing returns on file size.
Use lossless for logos and text. Anything with sharp edges, flat colors, or readable text benefits from lossless WebP to avoid blocky artifacts.
Serve WebP with a PNG fallback. If your CMS or framework supports it, use the HTML <picture> element to serve WebP to modern browsers while falling back to PNG for older ones:
<picture> <source srcset="image.webp" type="image/webp"> <img src="image.png" alt="Description"> </picture>
Automate it in your workflow. Add the batch conversion script to your build process so new images are automatically converted before deployment.
Summary
WebP is the right choice for modern web images. It's smaller than PNG and JPEG, supports transparency and animation, and is universally supported by today's browsers. ImageMagick makes the conversion on Windows straightforward — a single command for one file, or a PowerShell loop for an entire project.
Start with a quality setting of 80, compare the results visually, and adjust from there. Once you see the file size reductions, you won't want to go back to PNG for web delivery.
Have questions or a tip to share? Drop a comment below.