Brotli compresses 15–25% better than gzip for HTML, CSS, and JS at higher compression levels. The catch is encoding cost — Brotli level 11 is slow.
For static assets, pre-compress at build time. For dynamic responses, Brotli level 4 is roughly the same CPU cost as gzip level 6 with smaller output.
Most modern web servers (nginx 1.21+, Caddy 2+) ship with Brotli support built in.