HTML and CSS files are the most crucial part of your website and can play a vital role in page size thus being a major factor contributing to page speed. Compressing these files can help you reduce the file size by 60% ultimately helping you load your page fast.
Large pages can have a size of upto 1MB or more making them bulky and slow to load. Gzip compression is the best way to speed up your website and is a standard practice to reduce your page size finally helping you optimize your page speed. Compression allows web server to provide you smaller file sizes which eventually leads to fast page loading.
Gzip is a file format and software application used for file compression and decompression. Gzip compresses your web pages and stylesheets before sending them to visitor’s browser. Since this process reduces your transfer time, there can be a remarkable increase in page loading speed.
The page loading speed is drastically improved as your visitors need to download much smaller web files compared to the original ones.
Gzip is recommended and can be used for following file formats :
However, Gzip compression is not recommended for non-text files like graphics and zip in terms of cost versus benefit.
Whenever a browser requests for files from a web server, it checks gzip enabled request. If it’s enabled, it receives the gzip file which is much smaller than original.Just in case, it the server fails to deliver a gzip compressed, your browser will receives the uncompressed version of file, thus making sure that there is no fall out.
Following are the important reasons to use Gzip compression :
Gzip compression can be used with apache, WordPress, IIS, and a host of different servers.
However, let’s restrict our discussion on how to get this done with WordPress.
If you are not sure about how to do this and don’t want to mess around, just ping your hosting provider and ask them to get it done for you.
This is the best and our recommended way to enable GZIP Compression. This will help you achieve your target without using a plugin. Just copy paste the following code into your .htaccess file. If you have no idea on how to edit .htaccess file, then take a look at this article by WinningWp.
/* Start of .htaccess code */
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_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
/* End of .htaccess code */
Total Cache also has way to enable GZIP Compression for you under its performance section. To enable Gzip compression using w3 total cache, go to Performance > Browser Cache
This is another great plugin to enable GZIP Compression. It can help you reduce your page size by 60% – 80%. You can download this plugin here. The best part about this plugin is that you just need to install it and wait for the magic to happen. This is best for anyone who is not looking for something complicated.
DEFLATE Compression is another way of lossless data compression algorithm. You can use Deflate Compression by copy pasting the following code into your .htaccess file.
# BEGIN DEFLATE COMPRESSION
AddOutputFilterByType DEFLATE "application/atom+xml" \
# END DEFLATE COMPRESSION
Now that you have enabled GZIP Compression, it’s time to check out if it is working or not. You can check if GZIP Compression is enabled or not by logging onto Check GZIP Compression.
I hope this article will help you in understanding the concepts of GZIP Compression and various methods to enable for you website. So, have a great day ahead and happy GZIPPPING !!!0
Press 💚 below and join the other 13,000+ getting valuable updates from this blog.
Want us to analyze your site first and then use our services? No worries. Just fill out the form to the right and we will be happy to send you a free report about your current website.