Our entire country experienced a complete internet shutdown for five days, which caused the delayed response.

Enjoy upto
80% OFF

How to enable GZIP compression for faster web pages

How to enable GZIP compression for faster web pages

Do you want to know the easiest way to enable GZIP compression? If yes, this blog is just for you. 

GZIP compression not only increases site speed but also improves the ranking on search engine results. Consequently, it improves traffic and conversion rates. 

In fact, it’s one of the most essential ways to speed up a WordPress website. Again, users become frustrated and leave quickly because of a slow-loading website. Luckily, GZIP compression helps your site load more quickly.

So, it’s a good strategy for improving page speed. In this article, we’ll briefly explain GZIP compression. After that, we’re going to discuss the importance of GZIP compression. 

Then we’ll show the way to check if your site has GZIP compression enabled. By going through all these processes, you can enable GZIP compression with ease. So, let’s get the ball rolling. 

What is the definition of GZIP compression?

The GZIP compression process reduces the sizes of web page elements like HTML, CSS, JavaScript and PHP. These elements or files are mainly transmitted between the server and the user’s browser.  

You can complete the GZIP compression process through server configurations or with an effective plugin. This compression process delivers all your website files in a compressed format. Also, the process seamlessly decompresses and renders the files for the user’s browser. 

There are two types of compression techniques:

  • Lossy compression: This compression eliminates some information from the original file.
  • Lossless compression: This compression process preserves all the data within the original file. 

So, GZIP compression is a lossless compression method. It’s one of the effective ways to reduce the size of HTML, CSS, JavaScript, PHP and other files.

Why is GZIP compression important?

Smaller files lessen the load over your website’s or server’s space. So, the GZIP compression method allows your website to load quickly by compressing and decompressing the elements. 

File types that are often related to GZIP include the following:

  • .gz file: This file extension indicates that the GZIP algorithm has compressed the file.
  • .tar file, tarball: GZIP can be applied to compress .tar files.
  • .tgz, .tar.gz, .gz file: These extensions indicate a .tar file that is compressed using GZIP.

You can reduce the amount of data by up to 80% by GZIP compression. It’s one of the fastest methods of compression. It also uses fewer resources and little computing power than other methods. 

GZIP compression improves your website’s Search Engine Optimization (SEO) score by making it faster. 

That means an increment in website page loading speed positively correlates with search engine rankings. The more visible your website is, the higher it ranks, increasing website traffic and income.

A study by W3Techs shows that more than 99% of webmasters employ GZIP when compressing their website content.

GZIP compression is necessary for many reasons, including:

  • Most GZIP compression software solutions are open-source and free to use.
  • GZIP compression is used in around 58.9% of all websites.
  • Compared with other methods, GZIP requires less computing power and temporary data storage.
  • This method has an effective compression ratio. It can reduce the size of small text-based data files by around 70% and up to 90% for larger files.
  • The GZIP compression method is faster than many other alternatives.

GZIP is the current standard for file compression on the web. According to a research by W3Techs shows that of the websites that compress their content, more than 99% employ GZIP.

Gauge your site speed before and after you enable GZIP compression

You can use a website speed test tool to measure a website’s loading time. A website speed testing tool provides a detailed report of elements that affect a website’s performance. Some tools can also show the website’s rate of reduction in file size.

They also suggest tips and tricks to increase website speed. Furthermore, they also provide recommendations for compression algorithms to produce smaller files. 

Here are some popular website speed testing tools available on the internet:

Let’s check the website speed with GTmetrix (You can use any tools you prefer).

First, go to GTmetrix’s site. Enter your website’s URL into the field. Then click on Analyze


You can see the result where GTmetrix will show the overall performance of your website.

We recommend you take a screenshot of this result so that you can compare this data with future data after you enable GZIP compression.


How to check if your site has GZIP compression enabled?

If you want to enable GZIP compression, the first thing you need to do is to check if it’s already enabled.

When you are transferring files with GZIP compression, the web browser can accept the GZIP compression files. It’s usually completed by Accept-Encoding HTTP header in the browser’s request:

Accept-Encoding: gzip, deflate

Most browsers include this header in the request by default.

After compressing the files with GZIP, the server includes the following header:

Content-Encoding: gzip

It tells the browser about the decompression method of the files with GZIP compression. When you’re ready to compress your website’s files, you need to enable your server to handle GZIP requests. 

Sometimes, your site’s server may not enable GZIP compression by default. It depends on your site’s configuration. So, you need to check without unpacking your server’s contents. 

Now, it’s time to go through the following section to get a clear picture of how to check if your site has GZIP compression enabled. 

Here are 3 methods for checking GZIP is enabled:

  • Check GZIP compression using free tools,
  • Using browser developer tools,
  • Using Google Page Insights

Method 1: Check GZIP compression using free tools

There are some free tools to check the compression of GZIP files. That means you can easily check if the GZIP compression is enabled or not using these tools.

Here are 3 examples of free tools:

For this tutorial, we’re going to show how you can use the Small SEO Tool’s Check Gzip Compression tool to check whether your website is GZIP compression enabled. 

Let’s check the procedure. Go to the link of Small SEO Tools’  Check Gzip Compression


Enter your website’s URL in the Field. Then check the I’m not a Robot box. At last, click on the Check Compression button.


After following the above process, you’ll get to know if your site has GZIP compression enabled.


Method 2: Check GZIP compression using browser developer tools

This method is one of the most friendly ones. Because in this method, you don’t need to use any external tool to check a website’s GZIP compression. That means, your browser is just enough to check it out.

To do so, you can use the developer tools panel in your browser. Most browsers support inspecting page elements and viewing performance information.

To use a browser to find out if GZIP is enabled on a website, follow these steps:

In the browser, type the URL for the website.


Next, right-click on the page and choose Inspect to open the browser developer tools.


Select the Network tab. Here, all the resources sent by the web server will be visible to you.


Select the Headers tab.


Look for content-encoding: gzip from the Response Headers section.


Finally, you’ll be able to see if your site has GZIP compression enabled just like below.


Method 3: Check if your site has GZIP compression enabled using Google Page Insights

To check whether your website has GZIP compression enabled using Google Page Insights, follow these steps:

Visit Google Page Insights website and then Insert your website link in the required field of Google Page Insights.

Then click on Analyze.


Now you can see the total result and also check the compression of GZIP. 


That’s how you can check whether your website is using GZIP compression.

How to enable GZIP compression?

The configuration process for GZIP compression depends on your hosting provider and server architecture. You can check your hosting provider’s documentation for instructions on enabling GZIP compression. 

There are 3 methods to activate GZIP if it still needs to be done:

  • Edit the .htaccess file
  • NGINX web server
  • Using plugin for WordPress Website

Your host may not allow you to change the server files. We have listed some solutions for common web server setup to enable GZIP compression below: 

Method 1: Enable GZIP compression using the .htaccess file

The process may seem a little complicated for a beginner. However, having advanced knowledge in website development might help you move forward with ease. 

Here we’ll show you the way to modify the .htaccess file using the File Manager of your web hosting provider’s control panel. You can also use an FTP if you want.

Follow these steps to enable GZIP compression via the .htaccess file:

Step #1: Log in to Siteground hosting. Then go to the Websites tab.

Enable_GZIP_compression_using_ 16

Step #2: Click on the Site Tools button.

Step #3: Find Site. click the “Site” menu then open a new tab.

Enable_GZIP_compression_using_ 18

Step #4: Click on File Manager.

Enable_GZIP_compression_using_ 19

Step #5: Find public_html. Double Click public_html Folder.

Enable_GZIP_compression_using_ 20

Step #6: Now find the .htaccess file. Right-click on this file.

Enable_GZIP_compression_using_ 21

Step #7: In this step. Right-click on the .htaccess file then select the Edit icon.

Enable_GZIP_compression_using_ 22

Step #8: In this phase, the .htaccess file will open. 

Enable_GZIP_compression_using_ 23

Step #9: Now copy and paste the following code on the .htaccess file:  

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xmlin
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
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
<FilesMatch "\.(css)">
    ForceType application/x-httpd-php
#    php_value auto_prepend_file "/gzip-css.php"

Step #10: Here you can see the pasted code. 

Enable_GZIP_compression_using_ 24

Finally, click Ctrl+S (or CMD + S on Mac) to save changes to enable GZIP compression

What if you can’t modify your .htaccess file?

When you can’t modify your .htaccess file, you can effortlessly use PHP to render compressed elements. To this end, change your HTML file type to a .php extension and add this code to the top.

if (substr_count($_SERVER[‘HTTP_ACCEPT_ENCODING’], ‘gzip’)) {

We test the “Accept-Encoding” header and return a file of the gzipped version. This supports building your web server. 

Method 2: How to enable GZIP compression on an NGINX web server?

NGINX server software compresses HTML files by default. You can enable GZIP compression on your site’s files if your server uses NGINX. For this purpose, you have to open your nginx.conf file.

gzip on;

Then paste the following code:

gzip_vary on;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
gzip_min_length 1000;
gzip_proxied no-cache no-store private expired auth;

After that, save the file. Then, reload your NGINX configuration.

gzip_types specifies the file types. These file types have to be compressed. You can add or remove items from the above code snippet. 

You see gzip_min_length indicates the minimum length that the response must be to be compressed. Here, it’s set to 1000 bytes (one KB), but you can change this if you want.” 

Method 3: How to enable GZIP compression using a WordPress plugin?

This is the easiest way to enable GZIP compression if you’re using a WordPress website. To enable this method on a WordPress website, you have to install a WordPress GZIP compression plugin

It’s much better and easier than other methods, as modifying the .htaccess file can be a complex task for beginners.

Let’s have a look at the process of enabling GZIP compression with a plugin.

There are many plugins for this purpose available like:

Here we’ll show you the process with the free version of WP-Optimize Cache. However, you can use any plugin as per your preference. 

First, go to the Plugin section then click on Add New Plugin.


Search the plugin WP-Optimize Cache in the Search Bar. The plugin will appear after searching. To access the plugin, click on the Install Now button.


Then, Activate the plugin.


Now, in the left sidebar, a new menu item called WP-Optimize will appear.


 Select the WP-Optimize option.


The WP-Optimize tab will redirect you to the plugin’s dashboard. Now you can access the available features including GZIP compression.


To enable the GZIP compression click on the Cache tab which is on the right side of the panel.


Here you can see the GZIP Compression, click on that and you can GZIP compression is already enabled. 


That’s how you can enable GZIP compression using a WordPress plugin.

Final words

GZIP compression is an effective type of lossless compression method. You can use this technique to reduce file size and speed up WordPress websites.

If you enable GZIP compression, your site’s visitors will have a great user experience for a speedy site.

Mainly GZIP compression on a website can be enabled using two techniques. – installing a WordPress plugin or editing the .htaccess file

If you’re using WordPress, installing a plugin is an easier option than editing a .htaccess file for beginners.

You can select any preferable way to enable this compression of GZIP. However, if you get stuck in any of these steps, don’t hesitate to let us know in the comment section below. 

Someone from our team or community will come forward to give you a helping hand. Also, don’t forget to share this article with your friends so that everyone benefits. 

Last but not least, subscribe to our newsletters to get more exciting articles, news and offers directly in your inbox. 

You may connect with us on Facebook and X. Also, check out our YouTube channel to view videos.

Mehrin Ferdous Meem
Written by

Mehrin Ferdous Meem

Mehrin is a content writer of ThemeDev who prefers to write about tech products, travelling, health, food, lifestyle, marketing, technology etc. She also works for creating video. She has completed her Bachelor's degree in Computer Science and Engineering. Her hobbies include blogging, reading, cooking etc.

Table of Content

Table of Contents

LTD Deals: 10+ Pro Plugins

Limited Time Offer
LTD Deals: 10+ Pro Plugins

Offer ends soon! Don't let it get away this time!


Trusted by 25,099+ Customers

30 days Money Back Guarantee