Text compression is a very simple and effective method to save bandwidth and speed up your sites. And you need to use this method to improve the interaction with your users. But be careful that some of your data is not lost during text compression.
What does “Enable text compression” mean?
This issue means that the page includes text resources that are not served with compression. Consequently, your pages load slowly, which can harm your business.
You can read additional information about the text compression using Lighthouse:
https://web.dev/uses-text-compression/
What triggers this issue?
Some or all of the pages don’t have a content-encoding header set to br, gzip, or deflate. Each of these file formats is used for file compression. If you use one of them, the browser can download the zipped files, extract them, and show them to users.
How to check the issue?
We recommend you scan your site with online or offline crawlers. They show you problem pages that you need to correct. A crawler can take text-based resources and compress them with GZIP to determine potential savings of compressions. The tool doesn’t highlight a page:
- If the potential compression savings is a maximum of 10% of the original size
- If the original size of the response is less than 1.4KiB
Find out not only the information about text compression, but also the presence of technical errors on it!
Conduct a full audit to find out and fix all the site level and page level issues on your website.
Why is this important for my website?
You’ve created a web application (on WordPress or Shopify) with a front-end (Next js or Vue.js) and a back-end (Java or Laravel) for your business. But you also want to make your pages load faster. Therefore, you need to enable text compression that helps you to minimize the total bytes sent over the network with no negative impact to the user. Text-based resources like HTML, CSS and JavaScript will become smaller, and they will download more quickly. So you cannot optimize your site without file formats used for text compression.
You can watch the video by Moz about the crucial things of your site’s page speed and how to improve it:
How to fix the issue?
1. You need to enable text compression on your server (Apache, NGINX)
2. When a browser requests a resource, it will use the Accept-Encoding HTTP request header to point what compression algorithms it supports:
- Brotli. It’s the most effective way to decrease the file size of text-based resources
- GZIP. It’s a fallback for Brotli, which is supported in all major browsers. You can use it after installing the plugin WP Super Cache on your WordPress site
3. Your server returns the Content-Encoding HTTP response header to point what compression algorithm is used
If you use Apache servers, you can modify the code of the .htaccess file to enable text compression.
Besides, you can use a data compression ratio. It’s a measurement of the relative reduction in the size of data representation produced by a data compression algorithm. This ratio expresses the division of uncompressed size by compressed size.