As Google becomes increasingly concerned with website user experience, web developers are rushing to become compliant.
Yes, we're implying there will be implications on search engine results pages (SERPs)!
Besides implications for search, the negative impact of a slow loading website to user experience can also impede conversions.
According to Kissmetrics, 47% of consumers expect a web page to load in 2 seconds or less. If you’re running an e-commerce business, Kissmetrics again reports that up to 79% of customers say they're less likely to buy from the website, due to dissatisfaction with the user experience.
Web pages can take a lot of server space due to large file sizes. Although you might not notice the impact of these large files (and resulting slow page load times) have, there are plenty of tools that can help you diagnose page load issues:
- Google Pagespeed Insights: It’s good to get this information straight from the source!
If you’ve uncovered a page load issue, it’s time to take action.
Compression is commonly encountered in the computer world. Put simply, It is a very handy method of grouping a bunch of files into a smaller file.
For websites, WordPress GZIP compression is the equivalent of file compression. And it can do wonders for your website’s performance—especially when it comes to improving page load time.
Free Website Speed eBook
The 12-Step Checklist to
Achieve Loading Times Under 1 Second
What is WordPress GZIP Compression?
GZIP is a file format and a software application used for file compression and decompression.
GZIP compression was created by Jean-loup Gailly and Mark Adler. It was released as a free software replacement for the compression program used in early Unix systems.
As with the WordPress core software in general, GZIP was intended for use by GNU (open source, free software). The "G" in “GZIP” is from "GNU".
How Does WordPress GZIP Compression Work?
When users go to your website, their browsers download these text files and will begin rendering the website according to the code contained within these files. These codes are then translated to something readable and understandable to the average human.⌨️ Clean, semantic code is the gold standard for human operators looking to modify code over time. #WordPress Click To Tweet As machines, browsers don’t require all that extra whitespace and extra formatting used to improve readability. As long as the browser can analyze code content, it can be written in one long block of text.
In general, WordPress GZIP compression takes away the formatting that is mainly used for human understanding. Reducing the length of code also reduces the size of the file containing it.
How to Enable WordPress GZIP Compression
WordPress GZIP compression is actually something that you need to enable on the server side—not WordPress. When you host with GoDaddy or Kinsta, they have this already enabled as part of their standard hosting packages.
For other web hosts, it’s up to you to enable WordPress GZIP compression.
Based on the plugins you’re already using (or the web host where your website is stored), it’s possible that WordPress GZIP compression is already enabled. You can easily check to determine this by running your domain name through the GZIP compression checker.
If you’ve determined that WordPress GZIP compression is not yet enabled, there are multiple methods to get started—with different options for experienced backend web development and newbie WordPress users, alike.
1. Enabling WordPress GZIP Compression via .htaccess
This is the most common way to enable WordPress GZIP compression.
However, this particular method involves the possibility that you might break something. After all, .htaccess is a very sensitive server file, and one wrong move can mess up your whole website.
To reduce the likelihood of breaking your WordPress website, be sure to make a copy of the original file before making any changes. And back up your WordPress website!
Once you’ve covered all your bases, it’s time to get rolling.
The .htaccess file should be in the root folder of your website. This file, however, is usually hidden by default on both the remote server and your own machine, if you copy it.
The best way is to access the file is through FTP. Alternatively, you can use another admin interface or cPanel.
To enable WordPress GZIP compression in your FTP client, force hidden files to show.
Once you locate the .htaccess file, start editing it. Or, to be safe, download the file on your computer and first make changes on your own hard drive. The file is likely also hidden by default on your own machine, so force hidden files to show.
Add the following code, sourced from GTmetrix, either inside or outside # BEGIN WordPress and # END WordPress (it doesn’t matter where):
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/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/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
Save the file and replace your original .htaccess file. Then, run your website through the aforementioned GZIP Compression checker tool to make sure that you were successful.
2. Contact Your Web Host
If you’re not comfortable making changes to your website files, it’ll be easier to ask your web host to enable WordPress GZIP compression for you. It’s enabled by default on all GoDaddy and Kinsta servers and Siteground provides their own instructions for enabling WordPress GZIP compression.
In general, most web hosts will be willing to assist you with this query when you reach out to their customer support teams.
3. Enable WordPress GZIP Compression with a Plugin
Of course, if you’re using WordPress, there’s always a plugin that can make the job easier. The caveat? More plugins means more potential security vulnerabilities—and space on your server.
Regardless, these plugins can help you to easily enable WordPress GZIP compression.
Check and Enable GZIP Compression
Just as the name “Check and Enable GZIP Compression” suggests, this plugin is built for that same purpose. It’s simple: the plugin checks if your WordPress site has GZIP compression enabled and it will enable GZIP compression if it’s not yet done. This plugin has over 20,000 active users.
W3 Total Cache
W3 Total Cache is considered to be the number one WordPress caching plugin. A potential issue: WordPress newbies can easily break their website when using W3 Total Cache without proper configuration. If you know what you’re doing, you can also enable HTTP compression by going to the browser cache, and checking the box for HTTP (GZIP) compression.
WP Super Cache
WP Super Cache is another WordPress cache plugin that offers the option to compress code. To enable WordPress GZIP compression using WP Super Cache, go to the WordPress dashboard > WP Super Cache > Advanced > check the box for Compress pages so they’re served more quickly to visitors.
4. Enable GZIP on NGINX
If you’re running on NGINX (like Kinsta), look for your nginx.conf file and add the following code:
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
Final Thoughts: Everything You Need to Know About WordPress GZIP Compression
While there are plenty of ways to improve your WordPress site’s speed and page load time, GZIP compression is one of the easiest ways to do it.
Don’t wait for slow page load times to affect your businesses bottom line. Check your website to determine if WordPress GZIP compression is enabled. If it isn’t, you have plenty of tools at your disposal to turn the tides in your favor.
Once you’re done with WordPress GZIP compression, there are still several additional tactics you can employ for improving page speed. Educate yourself and take advantage of the available options—like image optimization plugins or using a CDN.
Want to give your feedback or join the conversation? Add your comments 🐦 on Twitter.