Brotli Compression for WordPress

Brotli Compression for WordPress

Last update:

Compressing your WordPress site’s files is a great way to shrink your page sizes and speed up your site. For a long time, GZIP compression has been used by web servers to deliver your site content compressed to the browser. Now Brotli is the new player!

Learn how to get Brotli Compression for your WordPress.

Table of Contents

What Is Brotli

Brotli is an open-source generic-purpose lossless data compression algorithm. Brotli was developed in 2013 by Google under the MIT license.

As a general-purpose lossless compressor, it can effectively compress any type of file without destroying data.

You can check Broti repo evolution in Github

Where we use the Brotli compressor?

When you open your WordPress page, the browser requests different non-compressed files like HTML, XML, CSS, SVG, Javascript, Json, Font, etc. These formats can travel uncompressed, but modern web servers and browsers can agree to exchange them in a compressed format. And the best part, the compress and decompress is done behind the scenes, between the server and the browser.

How to check if your WordPress is serving Brotli compressed files

When requesting page resources your server and browser exchange headers to agree in the compression method. The agreement has two stages:

  1. The browser sends a header telling the server it accepts compressed content (gzip and deflate are two compression schemes): 
    accept-encoding: br, gzip, deflate
    This “Accept-encoding” header is just a request by the browser, not a demand.
  2. The server sends a response if the content is compressed: 
    content-encoding: br
    In this example, the content travels compressed with Brotli.

You can observe these exchanged headers using the Chrome Developer Tools.

This image shows you the "content-encoding: br” of our wetopi home page:

Google developer tools response headers with Brotli compression for WordPress

Is Brotli for WordPress better than Gzip?

Yes, Brotli outperforms Gzip in Speed and Compression, and in addition it’s supported by most browsers.

Browser compatibility with Brotli compression for WordPress
Brotli compression has a 95.8% of global browser compatibility.

Brotli has a faster compression algorithm:

  • It compresses and decompresses data faster than other compression algorithms.
  • Compressing data using Brotli uses fewer CPU resources.

Brotli also has a better compression ratio:

There is a benchmark from the CDN Akamai, Understanding Brotli’s Potential. In this study, Akamai took a list of the top 1000 URLs, downloaded the Html, Css, and JavaScript, and served those files compressed with both Brotli and Gzip.

The Akamai benchmark showed that the:

  • Median Brotli savings was 82%
  • Median Gzip savings was 78%

More specifically, Akamai found that Brotli was:

  • 21% better at compressing Html
  • 17% better at compressing Css
  • 14% better at compressing JavaScript

Enabling Brotli compression

If you want Brotli compression, you have to enable it in your website’s server.

Enabling Brotli for your server can be a matter of minutes or hours, depending on your technology stack.

If you do not have Brotli compression with your current hosting provider and want to test it right now:

With Wetopi you get FREE Development Servers, Brotli ready,
and finely tuned to serve WordPress at lighting speed.

Signup in 10 seconds and get your free wetopi account

There is no unique solution. But don’t worry, we have curated a few links pointing to guides that describe how to get Brotli up and running for the most popular servers:

At wetopi, as a WordPress exclusive hosting, we know how a slow website can impact your business, and that’s why we focus on the latest technologies to improve performance. You can learn more on how to get Better WordPress performance and security with TLS 1.3 and how to Improve WordPress site speed with Cloudflare.

We are techies passionate about WordPress. With wetopi, a Managed WordPress Hosting, we want to minimize the friction that every professional faces when working and hosting WordPress projects.

Not a wetopi user?

Free full performance servers for your development and test.
No credit card required.

See how Wetopi stacks up against your current hosting

Try before you buy.

With no obligation on your part, we’ll migrate a copy of your website:

No hidden small text.
No commitments.
No credit card.