If you have ever run your website through a speed testing tool and seen a warning about "enable text compression," that warning is about Gzip. It is one of the simplest performance improvements you can make, and the results are dramatic.
What Is Gzip Compression?
Gzip is a lossless compression format that reduces the size of text-based files before your server sends them to a visitor's browser. Lossless means nothing is changed or removed - the browser decompresses the file and gets exactly the same HTML, CSS, or JavaScript that was originally on your server.
Think of it like a zip file you might send over email. You compress the file before sending, the recipient unzips it on their end, and the contents are identical to what you started with. Gzip works the same way, except it happens automatically on every single page request, in milliseconds.
What Kinds of Files Does It Compress?
Gzip works best on text-based files:
- HTML documents
- CSS stylesheets
- JavaScript files
- XML and SVG files
- JSON responses from APIs
It does not help much with images, PDFs, or video files because those are already compressed using their own formats. Trying to Gzip-compress a JPEG typically makes it slightly larger, so most servers are configured to skip binary files.
How Much of a Difference Does It Make?
The size reduction is significant. A typical uncompressed HTML page might be 80 KB. With Gzip, that same file is often 15 to 25 KB - a reduction of 60 to 80 percent. For a site with multiple CSS files, a large JavaScript bundle, and several pages loaded per session, this adds up to a meaningful improvement in load time, especially for visitors on mobile connections.
How to Enable Gzip in cPanel
If your hosting account runs on Apache (which is standard with cPanel hosting), you can enable Gzip by adding a few lines to your .htaccess file.
Step 1: Log in to cPanel and open the File Manager.
Step 2: Navigate to your website's root directory (usually public_html).
Step 3: Find the .htaccess file. If you do not see it, click Settings in the top right and enable "Show Hidden Files."
Step 4: Right-click the file and choose Edit. Before making any changes, download a copy as a backup.
Step 5: Add the following block to your .htaccess file:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE text/css text/javascript
AddOutputFilterByType DEFLATE application/javascript application/x-javascript
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml
AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>
Save the file. Gzip is now active.
If you use WordPress with a caching plugin like WP Rocket or W3 Total Cache, those plugins often handle Gzip configuration automatically through their settings panels - no manual .htaccess editing required.
How to Verify Gzip Is Working
Once you have enabled it, you should confirm it is actually running. A few tools make this easy:
- GTmetrix - Run a speed test and check the Waterfall tab. Look for a "Content-Encoding: gzip" response header on your HTML and CSS files.
- Check Gzip (checkgzipcompression.com) - Enter your URL and it will tell you immediately whether Gzip is active and how much compression you are getting.
- Browser DevTools - Open Chrome DevTools, go to the Network tab, reload your page, click any resource, and look for
content-encoding: gzipin the response headers.
Brotli: The Modern Alternative
Brotli is a newer compression algorithm developed by Google that typically achieves 15 to 25 percent better compression than Gzip on the same files. It is supported by all modern browsers and is available on servers running newer versions of Apache or Nginx.
If your hosting environment supports Brotli, it is worth enabling. Many quality shared hosting providers, including dotCanada, support Brotli on their servers. When Brotli is available, browsers request it automatically using the Accept-Encoding: br header, and your server delivers the smaller Brotli-compressed file instead of the Gzip version.
You do not have to choose between them - you can enable both. The server will serve whichever format the browser supports, with Brotli taking priority when available.
A Simple Win Worth Taking
Gzip compression is one of those rare optimizations that is nearly universally beneficial, free to implement, and quick to set up. If your site is not currently compressing text files, enabling Gzip today is one of the highest-return things you can do for your page speed scores and your visitors' experience.

