WebP Conversion & Delivery

Serve smaller WebP images to supported browsers

WebP is a modern image format that produces files 25–35% smaller than equivalent JPEG or PNG images. Compresso can automatically create WebP versions of your images and serve them to browsers that support it.

How It Works

WebP in Compresso is a two-step process:

  1. Conversion — Compresso creates a WebP copy alongside every optimized image
  2. Delivery — Compresso rewrites your page HTML so browsers receive the WebP version

Both steps need to be enabled for WebP to work.

Enabling WebP Conversion

Go to Compresso > Settings and enable WebP Conversion. This is on by default. Every image optimized from this point forward will also get a WebP version.

To create WebP versions for images that were already optimized, use Tools > Regenerate WebP on the settings page.

Choosing a Delivery Method

Under WebP Delivery, choose how Compresso serves WebP images to browsers:

Wraps each image in a <picture> element with the WebP source listed first. Browsers that support WebP will use it; others fall back to the original.

<picture>
  <source srcset="image.webp" type="image/webp" />
  <img src="image.jpg" alt="..." />
</picture>

This is the most compatible option and works with any server or CDN.

JavaScript

Swaps image sources on the client side after the page loads. Useful if picture tags conflict with your theme or page builder.

.htaccess Rewrite

Handles WebP delivery at the server level — no HTML changes needed. This is the fastest method but only works on Apache servers and does not work with CDNs (see below).

After changing the delivery method, clear your cache (browser, caching plugin, and CDN) to see the change take effect.

Using a CDN

If you serve images through a CDN pull zone with a different domain (e.g. https://cdn.yoursite.com), you need to tell Compresso what that domain is.

Go to Settings > CDN Integration and enter your CDN's root URL. Once set, Compresso will correctly identify CDN-hosted images as yours and serve WebP and AVIF versions for them.

Which delivery method to use with a CDN

Delivery methodWorks with CDN?
Picture tagsYes — after setting your CDN URL
JavaScriptYes — always
.htaccessNo — CDN requests bypass your server's rewrite rules entirely

If you use a CDN and select the .htaccess method, Compresso will show a warning in Settings. Switch to JavaScript delivery instead — it's the most reliable option when a CDN is in front of your site.

Full-Page Output Buffer

By default, Compresso only rewrites images that pass through standard WordPress filters (the_content, post_thumbnail_html, etc.). Some themes and page builders render images outside these filters.

If you notice images that aren't being served in WebP, enable the Full-Page Output Buffer toggle under the WebP delivery section in Settings. This buffers the entire page and rewrites all <img> tags before sending the response.

Output buffering processes the full HTML of every page request. On high-traffic sites or sites that already use output buffering (e.g. some caching plugins), this can cause performance issues or conflicts. Only enable it if you have images that aren't being converted by the standard method.

Developers can also control this programmatically with the compresso_skip_webp_output_buffer filter:

// Disable output buffer on specific pages
add_filter( 'compresso_skip_webp_output_buffer', function ( $skip ) {
    if ( is_page( 'heavy-page' ) ) {
        return true;
    }
    return $skip;
} );

Verifying WebP Is Working

Open your browser's developer tools, go to the Network tab, and reload your page. Filter by "Img" and check the Type column — you should see webp for your images.

On this page