How to Compress a WebP Image


For a very long time, digital images were simple. If you had a photograph, you used a JPG. If you had a graphic or a logo that needed a transparent background, you used a PNG.

Then Google introduced WebP, and it completely upended the rules.

WebP was designed specifically to fix the problems with the older formats. It is a modern, highly efficient format that can act like a JPG when you need lossy compression, and act like a PNG when you need transparency and lossless perfection. In almost every head-to-head test, a WebP file will be significantly smaller than an equivalent JPG or PNG while maintaining the exact same visual quality.

But just because a format is highly efficient doesn’t mean you can ignore optimization. I frequently see web developers convert their massive media libraries to WebP, only to realize their pages are still loading slowly because they didn’t actually compress the files before converting them.

A massive, unoptimized WebP file is still a massive file.

If you want your website to load instantly, you need to know how to compress a WebP image properly. Let me walk you through the mechanics of the format and the exact workflow you should use.

The Dual Nature of WebP

To compress these files effectively, you have to understand that the format has a split personality. It can operate in two entirely different modes: Lossy and Lossless.

WebP Lossy (The Photograph Mode)

When you use WebP in its lossy mode, it behaves very much like a JPG. It looks at your photograph, finds subtle color variations that human eyes struggle to detect, and averages them out. It permanently deletes invisible data to save space.

The difference is that the math behind WebP is simply better than the decades-old math behind JPG. It handles sharp edges and complex gradients much more gracefully. If you take a high-resolution photograph and compress it using WebP, the resulting file will typically be 25% to 35% smaller than if you used JPG, and it will look exactly the same.

WebP Lossless (The Graphic Mode)

When you use WebP in its lossless mode, it behaves like a highly optimized PNG. It refuses to throw away any visual data. It perfectly preserves sharp text, flat colors, and transparent backgrounds. Again, the algorithms are just more modern and efficient, often resulting in files that are 20% smaller than an equivalent PNG.

If you are curious about the technical differences between preserving data and deleting it, read my deep dive on lossy vs. lossless compression.

How to Compress Your Files

Because the format is so versatile, compressing it requires a little bit of thought. You can’t just blindly crush a file; you have to choose the right mode for the image.

Here is the exact workflow you should follow.

Step 1: Fix the Canvas Size

This rule applies to literally every image format on the internet. If you take a 12-megapixel photograph and convert it to WebP without changing the physical dimensions, it will still be a heavy file.

If your blog post only displays images at a maximum width of 800 pixels, do not upload a file that is 4000 pixels wide. Open your image editor and shrink the physical width down to 800 pixels. This instantly removes the majority of the file bloat. I wrote a thorough guide explaining why this works in my post covering image compression vs. image resizing.

Step 2: Choose the Right Mode

Look at the image you are trying to optimize.

  • If it is a photograph of a person, a landscape, or a complex scene, you must use Lossy compression.
  • If it is a logo, a screenshot containing text, or a simple illustration with flat colors, you must use Lossless compression.

If you try to run a sharp graphic through lossy compression, the text will get fuzzy. If you try to run a photograph through lossless compression, the file size will remain absolutely massive because the algorithm won’t be able to find any shortcuts.

Step 3: Dial in the Quality Slider

If you are using lossy compression for a photograph, you need to tell the tool how aggressive to be.

Most optimizers give you a slider from 1 to 100. For WebP, I usually find the sweet spot sits around 75 or 80. Drag the slider down, watch the preview image closely, and stop as soon as you notice the quality breaking down or becoming blocky.

If you are using lossless compression for a graphic, the quality slider actually controls “effort” rather than visual degradation. A lower setting will compress the file quickly but leave it slightly larger. A higher setting will force the computer to spend more time calculating the absolute most efficient way to store the data, resulting in the smallest possible file size without altering the image.

The Best Tools for the Job

Because WebP is a newer format, older photo editing software sometimes struggles to handle it correctly. Some legacy tools will quietly convert your WebP into a massive PNG in the background before trying to edit it, ruining the file size.

You need a modern tool that understands the dual nature of the format.

If you just need to quickly crush a file for a website, use the optimizer on our homepage. It is built to handle modern formats natively. It runs entirely in your browser, so your files are never uploaded to a random server, and it allows you to carefully control the compression algorithms to find the perfect balance between speed and quality.

When Should You Avoid WebP?

As amazing as the format is, there are a few rare scenarios where you might want to avoid it.

The biggest hurdle used to be browser support. Five years ago, if you put a WebP image on your website, anyone using an older Apple device couldn’t see it. Today, that problem is basically solved. Every major modern browser (Chrome, Safari, Firefox, Edge) fully supports the format.

However, if you are providing a downloadable image for your users—like a desktop wallpaper or a press kit photo—you should probably stick to JPG or PNG. Many older desktop applications and native operating system viewers still struggle to open WebP files natively, and it frustrates users when they download a photo they can’t easily open or print.

But for standard web design, blog posts, and ecommerce product galleries? WebP is the undisputed king. Stop relying on decades-old technology, run your media through a good compressor, and watch your website load times plummet.

Read Next