What is Gzip compression on websites

What is Gzip compression

Gzip is a file format and software application used in Unix systems to compress HTTP content before it is delivered to the client.

The process is known to compress a file by up to 80 percent, which improves page load time, and reduces bandwidth consumption.

The file types associated with gzip include:

  • .gz – Specifies a file extension compressed by the gzip algorithm.
  • tar file, tarball – A format used to store multiple files for archiving, but not for compression. and Gzip can be used to compress .tar files.
  • .tgz, .tar.gz, .gz file – Specifies a .tar file compressed by gzip.

Run the Gzip command

Gzip can be applied on a number of different platforms, including those listed below:


You can run gzip in WordPress using a cache plugin that supports gzip, or by running gzip on your web server using a .htaccess file.

Enabling GZIP on the Apache server

To enable gzip on an Apache web server, add the gzip compression commands within


The module is at the end of the .htaccess file.

for example:

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml 
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
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 

Enabling GZIP on an NGINX server

To enable gzip in NGINX, add the following code to the Nginx.conf file:

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_vary on;
gzip_types text/plain text/css text/javascript image/svg+xml image/x-icon application/javascript application/x-javascript;

Gzip Activation Verification

After running gzip, the next step is to make sure it compresses the outgoing files from your site. This is done by checking HTTP requests in the browser.

For example, by logging in to the Network in the Headers tab, from there you should get to the Content-Encoding header.

Gzip Activation Verification

In response, gzip should appear in the Headers in the expression Content-Encoding:

HTTP/1.1 200 OK
Server: nginx
Date: Mon, 21 Jul 2014 01:12:36 GMT
Content-Type: text/html; charset=UTF-8…
Vary: Accept-Encoding
Content-Encoding: gzip

Using Gzip compression in conjunction with CDN

Now we know What is Gzip compression, I explain how to conjunction Gzip and CDN.

Almost all content transfer networks (CDNs) provide automatic file compression with gzip. This alleviates the need to verify that compression does take place.

Besides, CDNs support many site-speed optimization techniques. That can used in conjunction with gzip to further reduce the output file size.

These include minimization, an optimization process in which components. Such as white spaces and recurring variable names cut from the source file code. Which can reduce the file size by half before compression.

Above all Most CDNs automatically perform minify compression, including JavaScript, HTML, and CSS files.

Although minify compression may seem redundant, it has been shown to reduce the junk file size by an additional 5-10%.

Because CDN performs both minify and gzip compression, they minimize the size of the code files transmitted to your users, significantly reducing page load time.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Scroll to Top