SEO

Compression (Gzip and Brotli)

Also called text compression, Gzip, Brotli

Server-side compression that shrinks text files such as HTML, CSS and JavaScript before they are sent, so pages download faster.

Quick facts: Compression (Gzip and Brotli)

Category
SEO
Also called
text compression, Gzip, Brotli
Level
Intermediate
Affects
Page load time, Core Web Vitals, bandwidth use, crawl efficiency
Where to see it
Chrome developer tools Network tab, PageSpeed Insights, Lighthouse, curl with an Accept-Encoding header
In this article4
  1. How compression works
  2. Why it matters
  3. Common mistakes
  4. How to act on it

Compression, in website performance, means the server shrinks text files such as HTML, CSS, JavaScript, JSON and SVG before sending them, and the browser unpacks them on arrival. Gzip and Brotli are the two formats almost every site uses.

How compression works

When a browser requests a page, it sends a header called Accept-Encoding listing the formats it understands, for example “gzip, deflate, br”. The server picks one, compresses the file and replies with a Content-Encoding header saying which it used. The browser decompresses the file before reading it. The whole exchange is invisible to the visitor.

Text compresses well because code is full of repetition: the same tag names, class names and function calls appear over and over. A large stylesheet or JavaScript bundle can often shrink to a small fraction of its original size.

  • Gzip has been around since the 1990s and is supported by every browser and server. It is the safe baseline.
  • Brotli was developed by Google and usually produces smaller files than Gzip for web text, partly because it ships with a built-in dictionary of common web strings. Every current major browser supports it over HTTPS.
  • Zstandard is a newer option. At the time of writing (October 2026) Chrome and Firefox accept it, but Gzip and Brotli remain the formats to get right first.

Compression can happen on the fly for each request, or files can be compressed once in advance and stored. Static assets such as theme stylesheets are good candidates for pre-compression at a high setting, since the work is done once. A content delivery network will often handle Brotli for you at its edge servers.

Why it matters

Fewer bytes means faster downloads, and the difference is largest where connections are weakest: a visitor on a patchy 4G signal on a train out of Waterloo, or in a rural area with slow broadband. The HTML document and the CSS that blocks rendering both have to arrive before anything is painted, so compressing them helps the first paint and the Largest Contentful Paint directly.

It is also one of the cheapest performance wins available. On most hosting it is a configuration setting rather than a development project, which is why I check it early in any technical review. A site that sends uncompressed HTML and scripts is wasting bandwidth on every visit, for every visitor, including Googlebot.

Common mistakes

  • Assuming the host has switched it on. Many do, some do not, and some compress HTML but not CSS or JavaScript. Check the response headers rather than the host’s sales page.
  • Compressing images and video again. JPEG, PNG, WebP, AVIF and MP4 are already compressed. Running Gzip over them uses server time for no saving.
  • Double compression. A plugin and the server both compressing the same file can produce garbled output or errors. Do it in one place.
  • Confusing compression with minification. Minification removes unnecessary characters from the code itself; compression packs what is left for transfer. You want both.

How to act on it

Open your site in Chrome, open developer tools, go to the Network tab and reload. Click the HTML document and a stylesheet and look for “content-encoding: br” or “content-encoding: gzip” in the response headers. PageSpeed Insights will also flag text resources that are sent uncompressed, though checking the headers yourself is the surer test.

If compression is missing, the fix depends on your setup: an Apache or nginx setting, a toggle in your hosting control panel, a caching plugin on WordPress, or a CDN option. On managed platforms such as Shopify, Squarespace and Wix it is handled for you. If the headers look right but pages are still slow, the cause lies elsewhere, and finding it is part of my technical SEO work.

Do and do not

Do

  • Check the content-encoding header on HTML, CSS and JavaScript
  • Use Brotli with Gzip as a fallback
  • Compress in one layer only

Do not

  • Compress images or video again
  • Assume the host has it switched on
  • Treat compression as a substitute for minification

Questions people ask about this

Is Brotli better than Gzip?

For text files served over HTTPS, Brotli usually produces smaller files, so it is the better first choice where your server or CDN supports it. Keep Gzip enabled as a fallback for any client that does not ask for Brotli. The server picks whichever the browser says it accepts, so running both causes no conflict.

Does compression affect SEO directly?

Not as a ranking signal on its own. It affects how quickly pages load, which feeds into Core Web Vitals and into how efficiently search engines can crawl the site. Think of it as a basic part of a healthy setup rather than a ranking lever.

Can compression break my website?

Correctly configured, it should not. Problems usually come from compressing the same file twice, for example through both a plugin and the server, or from a misconfigured proxy. If pages show garbled characters or fail to load after you enable it, switch off one of the layers and test again.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.