• Home
  • SEO

How to Enable Gzip Compression in WordPress to Increase Site Speed

What is Gzip Compression?

Gzip Compression is a method which compresses files(make them smaller) and increases the speed to which they are transferred to the browser.

For example, When a user visits or clicks on your website, a call is made to your server to deliver the requested file. Requested files are counted the total number of articles and files on your page, which includes images, ads, widget, scripts, HTML, CSS, Java scripts etc. The bigger files you have, the more time it will take to appear on your screen. That why here comes the one of the best method called Gzip Compression. In this tutorial, I am showing you how to enable Gzip Compression.

Why you need to Enable Gzip Compression on Your WordPress Website

As i mentioned above that Gzip Compression is one of the best way to optimise your website and also increase your page speed. It compresses your webpages and style sheets before sending them over to the browser. So if the total size of page is 100 KB , then only 10 KB file are sent to the browser. There are some benefits you are getting of using this, such as:

  • Compress 100 KB file to 10 KB
  • Reduces Page sizes & Increase page speed
  • Cost-benefit ratio: high

Simply you can check your page speed using GTmetrix. This tool will show you is your server Gzip Compression enabled or not. There is another Gzip Compression checker tool you can useCheck GZIP compression

check gzip compression

You can see that 76% was saved by compressing this page with GZIP. The primary size of uncompressed files was 30,599 bytes, and after compressed it is now only 7,350 bytes.

This Gzip Compression process is totally free, so you don’t need to buy a service or any tool. You just need to have access to the .htaccess file.


How to Enable Gzip Compression in WordPress

There are several ways to enable Gzip Compression on webservers. You can enable it from .htaccess, NGINX and use plugin.

Enable Gzip Compression via .htaccess (Recommended)

For this method, you will need to access to your cPanel. In the WordPress root folder, add the following lines to .htaccess file.

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

Save the .htaccess file and then refresh your web page. Now test your site again in GTmetrix or here to make sure it has been properly compressed.


Enable Gzip Compression on NGINX web servers

To enable compression in NGINX you will need to 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;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;


Enable Gzip Compression using Plugin

Gzip Compression Plugin

Download GZip Ninja Speed Compression plugin and activate from your Admin Dashboard. Then go to Tools> Gzip Compression and simply enable it.  No further setup required.


I hope this tutorial helped to enable Gzip Compression. Gzip Compression is one of the most important optimization processes for websites. If this helped to increase site speed, please share this topic on  Facebook, Twitter, Google+.

Related Articles,

*This post may have affiliate links, which means I may receive a small fee if you choose to purchase through my links (at no extra cost to you). This helps us to keep WPMyWeb up and running and up-to-date. Thank you if you use our links, we really appreciate it! Learn more.

Sharing is Caring
Jyoti Ray

Jyoti Ray is the founder of WPMyWeb.com. He writes about Blogging, WordPress tutorials, Hosting, Affiliate marketing etc. He mostly spends times on blogging, reading books and cooking.

Notify of

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

Inline Feedbacks
View all comments
where to buy viagra buy generic 100mg viagra online
buy amoxicillin online can you buy amoxicillin over the counter
buy ivermectin online buy ivermectin for humans
viagra before and after photos how long does viagra last
buy viagra online where can i buy viagra
blumen verschicken Blumenversand
blumen verschicken Blumenversand
Reinigungsservice Reinigungsservice Berlin
küchenrenovierung küchenfronten renovieren küchenfront erneuern