How to Enable GZIP Compression in WordPress

Decreasing the size of your pages is very important if you want to load pages faster in your WordPress website. A compressed file uses less bandwidths to download where an uncompressed takes higher. Enabling GZIP Compression will help you reduce the page size, saves data usage for client and most importantly reduce the amount of time to load contents. In a word, it will make your website load faster.

Most of the popular performance measurement tools like PageSpeed Insights, GTMetrix or Pingdom Tools will show you warning GZIP compression is not enabled. As most of the modern browsers support this, you should do this as a part of optimizing your website for speed.

I am going to show you how to check and implement GZIP compression on your WordPress website hosted in any Apache, NGinX or LiteSpeed web server. Before going to the main task, let me tell you something about GZIP compression and why it is important.

What is GZIP Compression?

Like JPG, PNG, html or css; GZIP is a file format and generally used as a software program to compress and decompress specific files.

If GZIP is enabled on your server-side, then all the HTML, CSS and JS files will be served as compressed files. This results in reduction of the size for these file types.

Note that, GZIP only works for files that includes only text. It will not work for media files like images, videos, gifs etc. Image Compression is somewhat different.

Verify GZIP Compression Status

You can test your site if it has GZIP Compression enabled on your hosting server or not. Though there are plenty of ways to check the status, I recommend these two methods. Easy!

Verify GZIP Compression with Pingdom Tools

To verify your website’s GZIP compression status with Pingdom Tools, simply go to this url: and test your site from any of their server locations. When the test will be complete, you will see an warning named “Compress components with gzip” like below if you don’t have GZIP enabled.

Pingdom Website Speed Test Report
Pingdom Website Speed Test Report

Verify GZIP Compression with GTMetrix

GTMetrix is another popular web tools you can use to identify issues behind slowing down your website. You can test your website with GTMetrix to identify if your web server is configured to serve compressed files or not. Check your site with GTMetrix at:

GTMetrix Website Performance Test Report
GTMetrix Website Performance Test Report

Enable GZIP Compression

So, I hope you understand the importance of enabling gzip/deflate compression in your WordPress website. Now, let me show you how you can enable this on your website.

Note: Make sure you have access to your cPanel/FTP

Enable GZIP with .htaccess

Login to your cPanel or FTP and find out the .htaccess file. Then, simply add the code below to enable GZIP Compression.

    <IfModule mod_deflate.c>
    # 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


    <IfModule mod_gzip.c>
        mod_gzip_on Yes
        mod_gzip_dechunk Yes
        mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
        mod_gzip_item_include handler ^cgi-script$
        mod_gzip_item_include mime ^text/.*
        mod_gzip_item_include mime ^application/x-javascript.*
        mod_gzip_item_exclude mime ^image/.*
        mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

Enable GZIP with Plugin

If you are not flexible at adding codes, simply install and activate the Enable Gzip Compression plugin in your WordPress website.

Final Words

In order to speed up your website, enabling GZIP compression is one of the major steps you can take. So, make sure your website has been configured properly to serve compressed contents to supported browsers. Increasing WordPress Memory Limit is another steps you could take to speed up your website. If this article helps, make sure you have shared. Also, if you encounter any problems or issues, feel free to comment below. I will reply to you soon.

[TheChamp-Sharing title="Sharing is Caring" count="1" total_shares="ON"]

Leave a Comment

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

seventy two − sixty seven =

Shopping Cart
Scroll to Top