🚀 Ultra-fast web hosting from just $1/month!
HostPedia

Brotli

Performance
Definition

Brotli is a modern lossless compression algorithm used to reduce the size of web assets such as HTML, CSS, JavaScript, and JSON before they are sent from a server to a browser. It typically achieves smaller files than Gzip at similar quality, improving page load times and lowering bandwidth usage. In hosting, Brotli is enabled at the web server or CDN layer and negotiated via HTTP headers.

How It Works

Brotli compresses text-based responses on the server and decompresses them in the browser. When a browser connects, it advertises supported compression methods in the Accept-Encoding request header (for example, br, gzip, deflate). If Brotli is enabled and the client supports it, the server returns a Brotli-compressed response and includes Content-Encoding: br so the browser knows how to decode it.

In practice, Brotli can be applied in two ways: dynamic compression (compressing on the fly per request) and static compression (serving precompressed .br files). Static compression is common for assets that change infrequently, such as versioned JavaScript bundles, because it avoids CPU overhead during peak traffic. Brotli is typically configured in Nginx or Apache, at a reverse proxy, or at a CDN edge, and it is most effective on compressible content rather than already-compressed formats like JPEG, PNG, MP4, or ZIP.

Why It Matters for Web Hosting

Brotli directly affects perceived performance and resource usage: smaller responses mean faster Time to First Byte to render completion on real networks, and lower bandwidth consumption can reduce the chance of hitting traffic limits. When comparing hosting plans, check whether Brotli is supported by the server stack or included via a CDN, whether you can control compression levels, and whether the platform supports precompressed static files for high-traffic sites without adding CPU load.

Common Use Cases

  • Compressing HTML output for CMS-driven pages (for example, WordPress)
  • Serving smaller CSS and JavaScript bundles for faster front-end performance
  • Optimizing API responses such as JSON for mobile clients and SPAs
  • Reducing bandwidth usage on high-traffic sites and during traffic spikes
  • Improving performance when paired with HTTP/2 or HTTP/3 and a CDN edge cache

Brotli vs Gzip

Both are lossless compression methods negotiated via Accept-Encoding, but Brotli often produces smaller files for text-based content, which can improve load times. Gzip is widely supported and may be cheaper to compute at certain settings, making it a safe fallback for older clients. Many hosting setups enable both: serve Brotli (br) when supported, otherwise fall back to Gzip, while avoiding compression for already-compressed file types.