
Compression
Web compression reduces the size of files transferred between a server and browser by encoding data more efficiently, with gzip and Brotli being the most common algorithms used.
When a browser requests a web page, the server can compress the response before sending it. The browser then decompresses it, this entire process is transparent to users but can reduce transfer sizes by 60-90% for text-based files like HTML, CSS, JavaScript, JSON, and SVG. Gzip has been the standard compression algorithm for the web since the late 1990s.
Brotli, developed by Google and released in 2015, offers 15-25% better compression than gzip, especially for static content. Most modern browsers support both. Compression is enabled at the server or CDN level.
In practice
- A corporate website's 500KB JavaScript bundle compressed to 95KB with gzip and 80KB with Brotli, loading in 0.5 seconds instead of 3 seconds on mobile
- An API response that was 2MB of JSON compressed to 180KB with Brotli, reducing API latency from 4 seconds to under 1 second on 4G connections
- A hosting migration accidentally disabled gzip compression, doubling page load times overnight, re-enabling it immediately restored performance
- A static site using Brotli pre-compression at build time (instead of on-the-fly) achieved maximum compression ratios while adding zero server CPU overhead
Not sure how this applies to you?
A senior engineer walks your site, your search presence and the way enquiries reach you, then writes down the three things worth fixing first. You keep the document either way.