How to gzip vs. brotli for svg files: a practical comparison
- Step 1Measure both on your actual SVGs — Use the JAD Compression Estimator on your most common SVG sizes. Note the actual compression ratio for each algorithm — it varies by SVG content type.
- Step 2Check your server/CDN support — Brotli: Nginx 1.11.6+, Apache mod_brotli, Cloudflare (all plans), AWS CloudFront, Vercel, Netlify. Gzip: universally supported. Check your stack.
- Step 3Implement the best supported option — If your CDN supports brotli, enable it for image/svg+xml MIME type. Keep gzip as fallback. The Accept-Encoding header negotiation handles the rest automatically.
Frequently asked questions
How much better is brotli than gzip for SVG?+
Brotli typically achieves 15–25% better compression than gzip on SVG files. For a 100 KB gzip-compressed SVG, brotli would deliver 75–85 KB — saving 15–25 KB per SVG.
Is brotli slower to compress than gzip?+
At maximum quality (level 11), brotli is much slower than gzip. But for dynamic compression on web servers, use brotli level 4–6 — competitive with gzip speed and still 10–15% better compression.
Does pre-compressing SVGs at build time help?+
Yes. Serving pre-compressed .svg.br files avoids real-time compression CPU cost entirely. Build-time brotli at level 11 achieves the best compression with no runtime overhead.
Does compressing SVG affect the browser's ability to read it?+
No. HTTP compression is transparent — the browser decompresses the response automatically based on Content-Encoding headers. The decompressed SVG is identical to the original.
Privacy first
Every JAD SVG tool runs entirely in your browser using the DOM API and Canvas. Your SVG files never leave your device — verified by zero outbound network requests during processing.