Gzip and Brotli compression on your business website: what it is, how to enable it, and speed up loading without changing your design

Gzip and Brotli compression on your business website: what it is, how to enable it, and speed up loading without changing your design
Published on 17/09/2026

Your website already has optimized images, browser cache, and maybe a CDN. But if you have not enabled Gzip or Brotli compression, you are still sending HTML, CSS and JavaScript uncompressed: more weight, longer downloads and a worse mobile experience.

Compression reduces the size of text files before they leave the server. The browser decompresses them automatically and visitors only notice faster loading. In this guide we explain what Gzip and Brotli are, when to use each one, how to enable them on common hosting setups, and what to check so nothing breaks.

What Gzip and Brotli compression means for a business website

Every time someone visits your site, the server sends text files: page HTML, CSS stylesheets, JavaScript, fonts and sometimes JSON or XML. Without compression, those files travel as-is. With Gzip or Brotli, the server compresses them first and adds an HTTP header (Content-Encoding) telling the browser how to decompress them.

  • Gzip has been the standard for years. Compatible with virtually all browsers and servers.
  • Brotli achieves better compression ratios (up to 20-25% smaller than Gzip on text). Modern browsers support it; for current traffic it is usually the preferred option.
  • It does not replace other optimizations: compressing an 800 KB CSS file is still worse than a well-minified 80 KB CSS file.
  • It complements SSL: HTTPS encrypts the connection; compression reduces the volume of data traveling through it.

Combined with Core Web Vitals and a solid caching strategy, compression is one of the best effort-to-impact performance improvements available.

Signs your website needs compression enabled

  • PageSpeed Insights or GTmetrix flag “Enable text compression”.
  • In browser DevTools (Network tab), CSS or JS files do not show content-encoding: gzip or br.
  • Your site takes more than 3 seconds on mobile despite optimized images.
  • You are on shared or legacy hosting and have never reviewed server configuration.
  • After a hosting migration, compression rules from the previous provider were lost.
  • You use WordPress or a CMS with many plugins and generated HTML weighs hundreds of KB.
Developer reviewing file compression in browser developer tools

Which files to compress (and which not to)

Compression works well on repetitive text content. Prioritize:

  • HTML pages, templates and dynamic responses.
  • CSS and JavaScript (including framework bundles).
  • JSON, XML feeds, sitemaps and text-based SVG files.
  • Web fonts in WOFF/WOFF2 formats.

Do not compress files that are already compressed: JPEG, PNG, WebP, AVIF, GIF, MP4, WebM, PDF or ZIP. If images are too heavy, fix image optimization, not Gzip.

How to enable Gzip and Brotli on your hosting

Apache (.htaccess)

With mod_deflate and mod_brotli, add rules to your root .htaccess. Enable Gzip first (broader compatibility), then Brotli if the module is available. Clear CDN cache after changes.

Nginx

In the server block, enable gzip on; with the right MIME types and brotli on; if compiled. Many managed hosts enable this by default.

Managed hosting

Check your control panel for “Gzip compression” or “Performance optimization”. If unsure, open a support ticket asking whether Brotli is active for your domain.

WordPress and plugins

Plugins like WP Rocket, LiteSpeed Cache or W3 Total Cache handle compression alongside page cache. Avoid duplicating rules in .htaccess and the plugin.

CDN (Cloudflare, etc.)

If you use a CDN, compression may happen at the edge. On Cloudflare, verify Brotli is enabled under Speed → Optimization.

Technician reviewing server performance in a data center

How to verify compression is working

  1. Browser DevTools: Network tab → reload → check a CSS or JS file for content-encoding: br or gzip in Response Headers.
  2. PageSpeed Insights: the “Enable text compression” audit should pass.
  3. curl: curl -H "Accept-Encoding: br,gzip" -I https://yourdomain.com and look for Content-Encoding.
  4. Compare sizes: Network “Size” column shows transferred (compressed) vs actual resource size.

Common mistakes when enabling compression

  • Double compression: server and CDN both compressing the same file can corrupt responses. Keep compression on one layer.
  • Forgetting HTTPS: some browsers only accept Brotli over HTTPS. Ensure your SSL certificate covers the whole domain.
  • Excluding APIs or AJAX: JSON responses from forms or search also benefit if they exceed a few KB.
  • Not updating after migration: always verify compression rules after changing hosting.
  • Relying only on a plugin: if you disable the cache plugin, compression may disappear. Configure it at server level too.

Quick checklist before closing the optimization

  1. Confirm HTML, CSS and JS are served with content-encoding: br or gzip.
  2. Verify images and videos are not unnecessarily compressed.
  3. Run PageSpeed Insights on mobile.
  4. Confirm forms, maps and analytics still work.
  5. Document which layer handles compression for future migrations.

Conclusion: faster loading without redesigning your site

Enabling Gzip and Brotli does not change your design or content — it only reduces the weight of text files your server sends. It is a technical improvement with direct impact on speed, mobile experience and Core Web Vitals.

If you are unsure whether your hosting already has compression enabled, or you want a full performance audit — compression, cache, images and CDN — aatsoft reviews business websites and prioritizes improvements that drive conversions. Request a free review and we will tell you where to start.

Àlex
Àlex
CEO & Full Stack Developer

More from the blog

Contact us

Reach out through your preferred channel and we will get back to you as soon as possible.

Contact us