Gzip Wordpress



GZIP, short for GNU Zip, is the most popular lossless data compression method on the web. It allows you to reduce the size of your site’s HTML pages, stylesheets, and scripts. Apart from being a data compression algorithm, GZIP is also a file extension (.gz) and a software used for file compression/decompression. Description Offers you the power to enable and disable Gzip compression on your WordPress site. Supports Apache HTTP Server. If you need help or plugin is not working for you, consider the premium version with also many other important features here.

Compressing your WordPress site’s files is a great way to shrink your page sizes, speed up your site and improve your Core Web Vitals performance.

As is the case with WordPress core software, GZIP was intended to be used by GNU, which is free open-source software. It actually lent the “G” from its name to GZIP. WordPress GZIP compression reduces the size of all the files that your website uses, including the ones under the hood like CSS, JavaScript and HTML. It isn’t perfect though. A simple way of enabling WordPress Gzip compression is by setting a few directives in your.htaccess file. We've already seen ways of optimizing site speed by leveraging browser caching via your.htaccess file, so if you're comfortable messing around with your.htaccess file, then this is the method for you. Do you want to enable GZIP compression in WordPress? GZIP compression makes your website faster by compressing the data and delivering it to the user’s browsers much quicker. A faster website improves user experience and brings in more sales and conversions for your business.

For a long time (since the 90s), GZIP compression has been the gold standard for web compression. But it’s not the only compression game in town – Brotli is a newer, Google-backed compression method that was released in 2013 and is quickly picking up steam.

So when it comes to Brotli vs GZIP compression for your WordPress website, which one should you be using? More importantly, does that question actually matter, or is either compression method fine? Let’s find out!

In addition to comparing both methods, we’ll also show you how to use both Brotli and GZIP compression on your WordPress site.

Brotli vs GZIP Compression: What’s the Difference?

Both Brotli and GZIP are methods to compress your website’s files. So at a high-level, both Brotli and GZIP are quite similar with respect to their core purpose.

The difference, of course, is in how they go about compressing your site and how effective they are.

Before we compare performance benchmarks, though, let’s cover the basics of GZIP and Brotli.

GZIP

GZIP’s initial release was all the way back in 1992.

Since the ’90s, GZIP has been the dominant format for web compression. It still retains that position today – according to W3Techs, 78.6% of websites use GZIP compression at some level.

GZIP is based on the DEFLATE algorithm and, while people usually just refer to it as a single compression tool, there are actually different “levels” of GZIP compression.

In total, GZIP has nine quality levels that balance compression level vs speed:

  • Level 1 – small file savings, but very fast compression speed.
  • Level 9 – maximum file size savings, but comparatively slow compression speed.

All major browsers support GZIP and most web hosts also support GZIP out of the box.

Brotli

Compared to GZIP, Brotli is much younger. It was initially released in 2013 by software engineers from Google, though it didn’t focus on HTTP compression until 2015.

While it took some time for adoption, Brotli is now supported by all major web browsers in 2019.

Like GZIP, Brotli also has different compression levels. In total, it has eleven different levels that follow a similar pattern as GZIP:

  • Level 1 – small file savings, but very fast compression speed.
  • Level 11 – maximum file size savings, but comparatively slow compression speed.

Brotli vs GZIP Benchmarks: Which Performs Better?

Ok – now for the important question:

Brotli vs GZIP compression – which performs better?

Here, we’ll turn to some public benchmark tests.

Before we dig into the data, it’s important to understand that there are multiple parts to compression and web performance:

  • Compression ratio – this is how big the file size savings are. E.g. a 2 MB file compressed to 1 MB.
  • Compression speed – this is how quickly it takes to compress and decompress the file. This is especially important for dynamic content that you need to compress “on-the-fly”.

Let’s look at the data…

First, there’s this benchmark from content-delivery giant Akamai.

Akamai took a list of the top-1,000 URLs, downloaded the HTML, CSS, and JavaScript, and compressed those files with both GZIP and Brotli. Akamai found that the:

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

Higher is better.

More specifically, Akamai found that Brotli was:

  • 21% better at compressing HTML
  • 14% better at compressing JavaScript
  • 17% better at compressing CSS

Those are the median numbers from Akamai’s tests.

But remember – compression is more than just smaller file sizes – it also matters how long it takes to perform the compression (AKA the compression speed).

Gzip wordpress htaccess

In terms of compression speed, Akamai found that it matters which “level” you use. GZIP was faster at some levels, while Brotli performed faster at some levels.

In the end, Akamai concludes that “if you tweak the Brotli settings a little bit, the compression speeds can actually surpass the speeds of GZIP while still providing some significant savings”.

OpenCPU also ran their own benchmarks and found that:

  • Brotli was superior in terms of the compression ratio
  • GZIP was much faster at on-the-fly compression. It’s unclear how much they “tweaked” these settings

Does the Difference Matter?

The data is clear that Brotli offers a better compression ratio than GZIP. That is, it compresses your website “more” than GZIP.

However, remember that it’s not just about the compression ratio, it’s also about how long it takes to compress and decompress data. There, the difference isn’t quite as pronounced.

In general, the data seems to suggest that:

  • Brotli is better at compressing static data because of its superior compression ratio
  • GZIP is better at compressing dynamic data because of its often superior compression speed

Akamai also notes that, if you play around with the Brotli settings, you can get compression speeds that rival GZIP while also benefiting from a better compression ratio.

Applications for mac os. In general, though, if you’re just an average WordPress user, I don’t think the GZIP vs Brotli debate is something you really need to worry about.

It’s important to use some type of compression. But for your average run-of-the-mill WordPress website, you don’t need to stress about whether you’re using GZIP or Brotli.

Additionally, GZIP compression is much easier to use on WordPress because of its almost universal adoption, so it’s a good starting point for most WordPress users that will still get your site the benefits of compression.

How to Use GZIP Compression on WordPress

First off, if you’re using WP Rocket, your site is already benefiting from GZIP compression. WP Rocket automatically activates GZIP compression as soon as you activate the plugin – you don’t need to perform any manual actions.

If you’re not using WP Rocket yet, WP Rocket offers an easy way to get started with GZIP compression on WordPress, but it’s certainly not the only way.

You can also activate GZIP compression…

  • Manually by adding a code snippet to your site’s .htaccess file
  • Via a dedicated WordPress GZIP compression plugin

Enable GZIP Compression on WordPress via .htaccess

If your site uses the Apache webserver (which most WordPress hosts do), you can enable GZIP compression by adding the following code snippet to your site’s .htaccess file:

Enable GZIP Compression on WordPress via Plugin

Many WordPress caching and performance plugins include GZIP compression as part of their features. Again, that includes WP Rocket.

However, if you just want a plugin that’s laser-focused on GZIP compression, you can use the free Enable GZIP Compression plugin at WordPress.org. Once you install and activate the plugin, go to Settings → GZIP compression and click the Enable GZIP compression button:

That’s it!

How to Test GZIP Compression

Once you’ve enabled GZIP compression, you use Varvy’s GZIP compression tester to make sure it’s working:

How to Use Brotli Compression on WordPress

Using Brotli compression on your WordPress site is a little more complicated.

First off, if you want to enable Brotli compression at a server level, you’ll need to pick a host that supports Brotli (or gives you server access to install the Brotli library yourself).

While almost every single host supports GZIP out of the box, finding a WordPress host that supports Brotli on shared or managed plans is much less common.

Gzip Wordpress

Thankfully, there’s another option that will work for all WordPress sites:

Wordpress Gzip Plugin

Cloudflare.

If you’re willing to use the Cloudflare CDN service, you can enable Brotli compression with the click of a button. Just look for the Brotli setting in the Speed tab of your site’s Cloudflare dashboard:

WP Rocket also has a dedicated Cloudflare integration that makes it super easy to get up and running.

How to Test Brotli Compression

Once you’ve connected your WordPress site to Cloudflare and enabled Brotli compression, you can test if it’s working by using KeyCDN’s Brotli test tool.

Brotli vs GZIP: Pick the One That’s Right For You

Gzip Wordpress Nginx

Both GZIP and Brotli help you compress your WordPress website’s files. GZIP is the older and more popular of the two, while Brotli is newer but picking up steam.

While Brotli does seem to outperform GZIP in some benchmarks, especially when you play around with its configuration, GZIP is probably still a better starting point for most WordPress users because:

Gzip Wordpress

  • It’s much easier to use with WordPress because almost every host supports GZIP out of the box.
  • It’s still quite competitive in benchmarks and will have a positive effect on your site’s page load times.

If you have the ability to manually install Brotli on your server, or if you’re willing to use Cloudflare, Brotli is certainly still a good option. It’s just not as popular, and therefore not as easy to use with WordPress.

Either way, remember that text compression helps improve the Largest Contentful Paint and the First Input Delay metrics. And that’s also why you should take care of it.