Brotli vs Gzip: what a CDN should compress

Brotli typically beats Gzip on HTML, CSS, JS and JSON. Cloud CDN negotiates encoding at the edge and leaves media binaries alone.

Text should not travel uncompressed from a global edge. Brotli usually wins on HTML, JS, CSS and JSON. Gzip remains the fallback. Images, video and zips should not be recompressed.

Negotiate at the edge

Cloud CDN applies Brotli or Gzip for eligible text. Origin can send uncompressed. Clients get the encoding they ask for.

Leave media alone

JPEG, WebP, MP4 and zip files are already compressed. Double compression wastes CPU and can enlarge the object.

Pair with hashed filenames

Compressed hashed assets can use long TTLs. You are not recomputing Brotli on every hit once the variant is cached.

APIs too

JSON bodies that pass through the edge are text. Brotli helps APIs as well as pages.

Frequently Asked Questions

It can. Cloud CDN still negotiates with the client. Avoid compressing already-compressed formats.

The client advertises encodings. Cloud CDN can send Gzip or identity instead.

No. They stack. See the HTTP/3 post.

Put this on Cloud CDN.

Get started with our Management Console in less than 2 minutes, or connect with an expert to supercharge your business today.