How to Enable Gzip Compression in WordPress for Faster Speed?

enable gzip compression

Enable Gzip compression to reduce the page size, so there will be fewer resources to download from the webserver. The browser would take less time to display the page, and even the client has to use the fewer data.

The simple process improves site performance, and Google encourages it.

So, the question is how to enable the Gzip Compression in WordPress for faster speed?

What is Gzip Compression?

Gzip compression means compressing data into a smaller file and then zipping it up. The data is accessible after unzipping the file.

In Gzip compression, similar strings are count as one, so all the repetitive data does not need to be sent separately.

How Gzip Works?

It’s all very technical, but let me explain it to you as simply as possible.

When it comes to basic, everything is binary. The universal language — 0 and 1. All the data is in binary language.

For example, this is the data:


Now it is in full form. But in the Gzip form it will be:

Three 1, three 0, four 1 — 313040

But yet again, there could be no 3 or 4 in the binary. It is either 0 or 4. Here it goes more technical. The computer assigned a binary value to these 3 & 4 too. And when those binary number creates a repetition, they are also compressed.

This way, a large file becomes incredibly small.

Why should you enable Gzip Compression?

You should enable Gzip compression for the fast loading speed of your site.

When the HTTP sends a request to the webserver for a page, the browser looks for a Gzip file. If they found it, the process takes less time to serve that small file. In the absence of the Gzip file, the whole web page is sent along with the response, and that page takes a long time to render.

How to find if the Gzip compression is enabled?

Tools to check if the Gzip Compression is enabled


enable gzip compression pingdom tool


enable gzip compression report on GtMetrix


GiftForSpeed test for Gzip

Sitechecker Pro report Gzip

There are lots of tools available for free, only a quick google search away.

If the Gzip is enabled, that’s fine, if not, you should do it.

How to Enable Gzip Compression

Gzip compression has to be enabled with server-side configuration.

  1. Enable Gzip Compression with WordPress Plugin
  2. CDN function
  3. On Apache
  4. Enable Gzip on NGINX

#1 Enable Gzip Compression with WordPress Plugin

Most of the quality caching plugin has a function that allows you to enable/disable the Gzip compression on your site.

Caching plugins to enable Gzip:

  • WPRocket
  • W3 Total Cache
  • Pagespeed Ninja
  • WP Super cache

Besides these caching plugins, there are WordPress plugins for this specific job.

Enable Gzip Compression Plugin

enable gzip enable gzip compression

However, compression has to be done on the server-side, so these plugins require your hosting permission.

#2 Enable with CDN

If you are using CDN, you can enable Gzip compression. All the popular CDN providers support Gzip compression.

#3 Enable GZIP on Apache

You can enable Gzip on Apache by adding the following lines in the .htaccess file.


   # Compress HTML, CSS, JavaScript, Text, XML and fonts
   AddOutputFilterByType DEFLATE application/javascript
   AddOutputFilterByType DEFLATE application/rss+xml
   AddOutputFilterByType DEFLATE application/
   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 (only needed for really 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

Note: Make the backup of the .htaccess file before making any changes.

#4 Enable Gzip on Nginx

You can enable Gzip on Nginx by adding these lines to the Nginx.conf 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_vary on;

Note: Make the backup of the Nginx.conf file before making any changes.

Does file compression reduce quality?

Zip format of the file does not reduce the quality of the data. However, there are chances of losing the data, as even the error of the few bits could cause the unzipping of the file. Though the chances of this are low.

How does WordPress determine Gzip compression?

Once activated, GZIP compression will be automatically enabled on your website. However, you might have to reset the permalinks. Navigate to Performance » General Settings page in your WordPress dashboard. Reset the permalinks and click the ‘Save all changes’ button to make changes.

With ServerGuy, you don’t have to worry about it. We optimized WordPress hosting to compressed Gzip files.

Wrapping Up

After enabling the Gzip compression, do check it with any of the above-mentioned tools.

This is a small yet standard web practice, and it improves the speed of the site. If you are not doing it for some reason, you must know that all of your competitors are doing it.

I hope this article helps you in enabling the Gzip compression safely on your site. If there is an issue, leave it in a comment.

Latest WordPress Tips, Guides, & News

Stay updated with new stuff in the WP ecosystem including exclusive deals, how-to articles, new plugins, and more. 100% WordPress Goodness, a promise!

1 thought on “How to Enable Gzip Compression in WordPress for Faster Speed?”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

We can help you. Right now.

Fast growing merchants depend ServerGuy for high-performance hosting. Experience counts. Let's get started.

Talk to a sales representative

USA / Worldwide




Core Web Vitals Book COver

Is your website ready for Core Web Vitals?

Take this FREE book with you and optimize your store for speed.

Learn all about new Google new ranking factors and get that top ranking.