No Login Data Private Local Save

Brotli Compression Level Tester - Online Optimal Setting

9
0
0
0

Brotli Compression Level Tester

Test and compare all 12 Brotli compression levels to find the optimal balance for your content

0 chars | 0 bytes (UTF-8)
Frequently Asked Questions
Brotli is a modern lossless compression algorithm developed by Google, first released in 2015. It combines the LZ77 algorithm, Huffman coding, and second-order context modeling to achieve superior compression ratios compared to older algorithms like Gzip and Deflate. Brotli is widely supported by all major browsers and is the default compression method for many CDNs and web servers. It excels at compressing text-based content such as HTML, CSS, JavaScript, and JSON.
Brotli offers 12 compression levels, from 0 (fastest, least compression) to 11 (slowest, maximum compression).

Level 0–3: Very fast, moderate compression. Suitable for real-time compression where latency is critical.
Level 4–6: Balanced speed-to-ratio. Level 4 is often the sweet spot for dynamic on-the-fly compression in production.
Level 7–9: Higher compression, noticeably slower. Good for caching scenarios.
Level 10–11: Maximum compression. Best for static asset pre-compression (build-time), where compression happens once and is served many times.
Dynamic compression (real-time): Use level 4 or 5. This gives ~80-85% of the maximum possible compression while keeping CPU usage low and response times fast.
Static pre-compression (build-time): Use level 11. Since compression happens once during deployment, you can afford the extra time for the smallest possible file sizes.
CDN with Brotli: Most CDNs default to level 5–6 for dynamic content and support level 11 for origin pre-compressed assets. Use this tester to see the actual difference on your specific content.
Brotli consistently outperforms Gzip in compression ratio, typically producing files 15–25% smaller than Gzip at comparable settings. However, Brotli is generally slower at higher compression levels. For dynamic content, Brotli level 4 achieves similar speed to Gzip level 6 while producing smaller output. For static assets, Brotli level 11 can produce files 20–30% smaller than Gzip maximum. All modern browsers support Brotli, making it the preferred choice for web content delivery.
For very small inputs (typically under ~50–100 bytes), Brotli compression may produce output larger than the input. This is because the compressed stream includes metadata, dictionary references, and header information that add overhead. This is normal behavior for any compression algorithm. The compression ratio becomes favorable as the input size grows. For web performance, the overhead is negligible because Brotli is applied to files that are usually kilobytes or megabytes in size.
The lgwin parameter controls the size of the sliding window used during compression, expressed as a base-2 logarithm. The default is 22, which means a 4 MB window (2^22 bytes). Larger windows can improve compression ratio for large files with repetitive patterns far apart, but they also increase memory usage during compression and decompression. The valid range is 10–24. For most web content, the default of 22 is optimal.
Brotli supports three compression modes:
Generic (0): Default mode, works well for all data types.
Text (1): Optimized for UTF-8 text content. Uses a built-in dictionary of common words and phrases to improve compression of natural language and code.
Font (2): Optimized for WOFF 2.0 font data, with special handling for font-specific structures.
For HTML, CSS, JS, JSON, and plain text, the Text mode usually yields 2–8% better compression than Generic mode at the same level.
Brotli is supported by all major modern browsers: Google Chrome (version 50+), Mozilla Firefox (version 44+), Microsoft Edge (version 15+), Apple Safari (version 11+), and Opera (version 38+). Both desktop and mobile versions are supported. As of 2024, global Brotli support exceeds 97% of web users. Servers typically negotiate via the Accept-Encoding: br header, falling back to Gzip for older clients.