How to speed up your website with gzip compression
Compressing your content saves bandwidth and improves render time, particularly on devices with slow internet connections but it also reduces load on your server. While it does take some amount of computer power to compress files on the fly, you save much more power by having your server doing fewer things at once. It takes a lot less time to transfer files that are smaller. Your server is therefore, at any given time, maintaining far fewer open connections. There really is no down-side to enabling some form of HTTP compression.
If you don’t have GZIP compression enabled, there are a couple ways you can go about enabling it on your webserver.
The second way to enable Gzip compression is by editing your .htaccess file. Most shared hosts use Apache, in which you can simply add the code below to your .htaccess file. You can find your .htaccess file at the root of your WordPress site via FTP.
Ensure to add the these lines at the bottom of the .htaccess file.
if the above methods are not worked, simply add this line to the top of your PHP documents:
<? ob_start("ob_gzhandler"); ?>
It has to be inserted before any content is outputted. It’s not as efficient as mod_deflate, but it still works well and saves a ton of bandwidth and processor power.
And that’s it!
You can test the result directly with your browser developer’s tool (inspector), or by using some online tools such as: HTTP Compression Test. Just enter your site’s URL, and it will tell you if it is actually gzipped, and if it is, you will see the impressive compression ratio.