Brotli Compression for WordPress

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!

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 is used 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 files are compressed with Brotli

When requesting page resources your server and browser exchange headers in order 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 case, 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:

Developer tools response headers when loaded with content.encoding Brotli

Is Brotli better than Gzip?

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

Brotli is 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

Brotli support needs to be enabled on your website’s server for it to actually work.

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

We at wetopi give you FREE Development Servers, Brotli ready and finely tuned to serve WordPress at lighting speed.

Signup in 10 seconds and get your free wetopi account

Enabling Brotli for your server can be a matter of minutes or hours, depending on your technology stack. 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, we want to minimize the friction that every professional face when working and hosting WordPress projects.

In short, we are just techies passionate about WordPress. With wetopi, a specialized WordPress hosting, we want to go further to offer professionals and agencies a platform to work efficiently and effectively.

Not a wetopi user?

Try now – you’ll find an efficient way to work with WordPress

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

Joan VegaBrotli Compression for WordPress
Share this post