Brotli Vs GZIP for WordPress – Which One To Choose?

You may already know about the Core Web Vitals, a new initiative from Google. Users always look out for how quickly they can start interacting with a page. That’s the goal of Core Web Vital metrics, to measure and improve the user experience by focusing on how your website delivers high-quality UX.

However, there are several ways to follow when you think about improving your site’s core web vital performance. One of the best ways of them is compressing your WordPress sites to shrink the page sizes, which helps to speed up your site.

When it comes to web compression, there are two different compression options that we get the most. These are GZIP and Brotli Compression, but which one should you choose? Let’s find out from this guide.

In this guide, I’ll share the comparison between Brotli vs GZIP for WordPress. So, stay tuned.

What Are Brotli and GZIP, and How Do They Work?

Before starting comparing both these compressions, first, let’s know the basics of GZIP and Brotli.

GZIP

Let’s start with GZIP, the older one, which was released on 31st December 1992. Since then, GZIP has been the prominent one for web compression. Even today, it retains its best position and popularity as well.

As per W3Techs, 87% of all websites use compression, and among them, 65% use GZIP compression. It works great to reduce the number of duplicate code and white spaces from a site’s file.

GZIP uses the DEFLATE algorithm; this single compression tool actually has different “levels” of GZIP compression. In total, it offers nine levels to balance the compression level and speed.

While level one offers small file saving with fast compression speed, level nine comes with maximum file size savings with comparatively slow compression speed. What keeps GZIP out of the box is, all major browsers and web hosts support it.

You can activate GZIP compression in two ways on your WordPress site-

  • Manually by adding a code snippet
  • Via WordPress GZIP compression plugin.

I’ll show you both the ways here for your convenience. So, let’s take a look.

Enable GZIP Compression on WordPress via .htaccess

If you’re using an Apache web server, you can add the following code snippet via accessing your site’s .htaccess file.

<IfModule mod_deflate.c>
# Enables GZIP compression
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs in old browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

Or, if you’re using an NGINX web server, add the following code to your config file.

gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;

Enable GZIP Compression on WordPress via Plugin

If you’re not comfortable with coding and all, there is a simple solution for you. Simply use this free WordPress plugin called Enable GZIP Compression. The using process is really simple; you just need to-

  • Install and activate this plugin.
  • Then go to settings from the WordPress dashboard and navigate to GZIP compression.
  • After that, click on the Enable GZIP compression button.
  • Once enabling the GZIP Compression, use a page load speed analyzer called Varvy’s GZIP compression tester to ensure the compression is working correctly.

Brotli

Software engineers of Google released Brotli on 15th October 2013. Initially, it didn’t focus on HTTP compression, but from 2015 Brotli started following it. Currently, it is supported by all major web browsers.

Compared to GZIP, Brotli takes some time for adoption. Till now, 35.5% of the website uses Brotli. It also offers different compression levels that follow the same pattern as GZIP.

Brotli has 11 compression levels, and level 1 provides small file saving with very fast compression speed. On the other side, level eleven offers maximum file size savings with comparatively slow compression speed.

Using Brotli is a bit complicated as it requires enabling Brotli compression at a server level. That means you need to choose a host that supports Brotli or give access to your server for installing the Brotli library.

Still, you can enable Brotli compression by using the Cloudflare CDN service. Simply go to the speed tab of your site’s Cloudflare dashboard and enable the Brotli setting.

After that, run a test to see if Brotli compression is working or not by using KeyCDN’s Brotli test tool.

Brotli Vs GZIP for WordPress

Brotli Vs GZIP for WordPress

Both these compressions are quite similar with respect to their core purpose, which is compressing your website’s files. But, the difference is in their techniques and how effectively they compress. 

So, here’s the comparison between Brotli vs GZIP for WordPress, along with how they work for you.

When it comes to comparing compressions, you should consider the compression ratio and speed. To compare both these compressions, I’m going to share the benchmark from Akamai’s Test.

Akamai made compression of HTML, CSS, and JavaScript of top 1000 URLs with both GZIP and Brotli. And the following are the median number results of that test-

Brotli vs. GZIP — HTML

Brotli vs. GZIP — HTML

The higher, the better, right? Here, Median Brotli was 21% better than GZIP at the compression of HTML.

Brotli vs. GZIP — JavaScript

Brotli vs. GZIP — JavaScript

Median Brotli Improvement Over GZIP is 14%

Brotli vs. GZIP — CSS

Brotli vs. GZIP — CSS

Median Brotli compresses 17% better than GZIP.

As I said before, you have to consider compression speed and the ratio or size. So, in terms of speed, Akamai found that GZIP was faster than Brotli at some levels.

Another test by OpenCPU stated that- Brotli was faster than GZIP in terms of compression ratio. On the other hand, GZIP was faster at on-the-fly compression.

So, from this data, it’s clear that Brotli is good at compressing static data with its better compression ratio. And GZIP is good at compressing dynamic data with its superior speed.

Conclusion

Brotli vs GZIP for WordPress, both compress your site’s file effectively. Although GZIP is the oldest and most popular one, Brotli is picking up the steam well despite being new.

In some benchmarks, when you consider the configurations, Brotli outperforms GZIP. In contrast, maximum WordPress users still prefer GZIP as a better starting point, as it is very easy to use and almost every host supports GZIP.

So, what is your preferred one or which one you are using currently? Let me know in the comment section below. Also, don’t forget to share your thoughts about this guide.

If you have any queries about boosting your WP speed, you can Contact Us. we are always there to help you out.

Leave a Comment