The WebP format, developed by Google, has become the standard for web images in 2026. It offers superior compression (30-50% smaller size) without sacrificing visual quality, resulting in faster websites and better SEO rankings.
In this comprehensive guide, you'll learn how to convert your images to WebP on any operating system.
Why Migrate to WebP?
Before diving into the "how", let's look at the "why":
- Reduced size: Up to 50% lighter than JPEG and PNG
- Better quality: More efficient compression algorithm
- Universal support: Chrome, Firefox, Safari, Edge (all since 2020)
- Improved SEO: Google PageSpeed Insights actively recommends it
- Transparency and animation: Supports both alpha channel and animated GIFs
Conversion on Windows
Method 1: Google WebP Codec (Official)
- Download the official Google tools: https://developers.google.com/speed/webp/download
- Extract the ZIP file (contains
cwebp.exe) - Open CMD or PowerShell in the image folder
- Execute:
cwebp -q 80 image.jpg -o image.webpUseful parameters:
-q 80: Quality (0-100, recommended 75-85)-lossless: Lossless conversion-resize 1920 0: Resize maintaining aspect ratio
Method 2: XnConvert (Graphical Interface)
- Download XnConvert (free): https://www.xnview.com/en/xnconvert/
- Add your images (supports batch processing)
- In "Output", select WebP format
- Adjust quality and convert
Advantage: Convert hundreds of images at once with preview.
Method 3: GIMP or Photoshop
GIMP (free):
- Open the image → File → Export as → choose .webp
- Adjust quality in the dialog
Photoshop (2023+):
- Requires WebPShop plugin: https://github.com/webmproject/WebPShop
- Then works like any other format
Conversion on Linux
Method 1: Command Line (cwebp)
Install WebP tools:
# Debian/Ubuntu
sudo apt install webp
# Fedora/RHEL
sudo dnf install libwebp-tools
# Arch
sudo pacman -S libwebpBasic conversion:
cwebp -q 85 image.jpg -o image.webpBatch conversion (bash script):
#!/bin/bash
for img in *.jpg; do
cwebp -q 85 "$img" -o "${img%.jpg}.webp"
doneMethod 2: ImageMagick
If you already have ImageMagick installed:
convert image.jpg -quality 85 image.webp
# Batch conversion
mogrify -format webp -quality 85 *.jpgMethod 3: GIMP (Linux)
Just like on Windows, GIMP on Linux natively supports WebP in recent versions.
Conversion on Mac
Method 1: Homebrew + cwebp
# Install Homebrew if you don't have it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install webp
brew install webp
# Convert
cwebp -q 85 image.jpg -o image.webpMethod 2: Automator (Graphical Interface)
Create a quick action in Automator:
- Open Automator → New Quick Action
- Add "Run Shell Script"
- Paste this script:
for f in "$@"
do
/usr/local/bin/cwebp -q 85 "$f" -o "${f%.*}.webp"
done- Save as "Convert to WebP"
- Now you can right-click on images → Services → Convert to WebP
Method 3: Third-Party Apps
- Squash: https://www.realmacsoftware.com/squash/ (paid)
- ImageOptim: https://imageoptim.com/ (free, also converts to WebP)
Online Tools (No Installation)
If you prefer not to install anything:
- Squoosh.app (Google): https://squoosh.app/
- Side-by-side visual comparison
- Precise quality control
- Privacy: conversion in the browser
- CloudConvert: https://cloudconvert.com/jpg-to-webp
- Batch conversion
- Supports many formats
- FreeConvert: https://www.freeconvert.com/webp-converter
- Up to 1GB per file free
Important: With online tools, your images are uploaded to external servers.
Automation in WordPress
WebP Express Plugin (Recommended)
- Install from WordPress repository
- Settings → WebP Express
- Conversion method: "Imagick" or "cwebp"
- Activate "Alter HTML" to serve WebP automatically
- Convert existing images with "Bulk Convert"
Imagify or ShortPixel Plugin
Both offer:
- Automatic conversion on upload
- Additional optimization
- Limited free plans
Via .htaccess (Advanced)
If you prefer to serve WebP manually with fallback:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} (.*)\.(jpe?g|png)$
RewriteCond %1.webp -f
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
AddType image/webp .webpScripts for Batch Conversion
Bash (Linux/Mac)
Convert all JPGs in a folder while maintaining structure:
#!/bin/bash
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | while read img; do
output="${img%.*}.webp"
if [ ! -f "$output" ]; then
cwebp -q 85 "$img" -o "$output"
echo "Converted: $img"
fi
donePowerShell (Windows)
Get-ChildItem -Filter *.jpg | ForEach-Object {
$output = $_.BaseName + ".webp"
& "C:\path\to\cwebp.exe" -q 85 $_.FullName -o $output
}Python (Cross-platform)
from PIL import Image
import os
for filename in os.listdir('.'):
if filename.endswith(('.jpg', '.jpeg', '.png')):
img = Image.open(filename)
webp_name = os.path.splitext(filename)[0] + '.webp'
img.save(webp_name, 'webp', quality=85)
print(f'Converted: {filename} → {webp_name}')Requires: pip install Pillow
Quality and Size Comparison
Based on tests with typical web images:
| Original Format | Size | WebP (q=85) | Savings |
|---|---|---|---|
| JPEG (high quality) | 850 KB | 420 KB | 50% |
| PNG-24 with transparency | 1.2 MB | 580 KB | 52% |
| PNG-8 (256 colors) | 180 KB | 95 KB | 47% |
Recommended quality:
-q 85: Perfect balance quality/size (general use)-q 75: More compression, still excellent quality-q 90-100: For professional photography-lossless: For graphics with text, logos
Compatibility and Fallbacks
Browser Support (2026)
✅ Support WebP:
- Chrome/Edge (since 2010/2018)
- Firefox (since 2019)
- Safari (since 2020)
- Opera (since 2011)
❌ Don't support:
- Internet Explorer (discontinued)
- Some very old browsers (<1% of web traffic)
Implementing Fallback in HTML
<picture>
<source srcset="image.webp" type="image/webp">
<source srcset="image.jpg" type="image/jpeg">
<img src="image.jpg" alt="Description">
</picture>The browser loads WebP if compatible, otherwise uses JPG.
Tips and Best Practices
✅ Recommendations:
- Keep originals: Always save source images (JPG/PNG)
- Test different qualities: q=85 is a good starting point
- Use lossless only when necessary: Logos, diagrams, text
- Combine with lazy loading: Load images only when visible
- Optimize before converting: Resize to final size before WebP
- Verify with PageSpeed Insights: Confirm actual improvement
❌ Avoid:
- Converting already heavily compressed images (low-quality GIFs)
- Using q=100 unnecessarily (very large file)
- Deleting originals immediately
Validation Tools
After converting, verify the results:
- PageSpeed Insights: https://pagespeed.web.dev/
- GTmetrix: https://gtmetrix.com/
- WebPageTest: https://www.webpagetest.org/
Compare size and load time before/after.
Conclusion
In 2026, WebP is the standard format for web images. With the right tools, conversion is simple on any operating system:
- Windows: XnConvert for GUI, cwebp for CLI
- Linux: cwebp or ImageMagick, ideal for scripts
- Mac: Homebrew + cwebp or Automator
- WordPress: WebP Express for total automation
- Online: Squoosh.app for quick conversions
The initial time investment is quickly recovered with faster sites, better SEO, and more satisfied users.
What method do you use to convert to WebP? Share your experience in the comments.
Sign IN
Comments: (0)
There are no comments yet.