About this tool
Generate nginx gzip and brotli directives with tuned compression levels, MIME type lists and minimum length.
This generator writes ready-to-paste nginx compression directives from the ngx_http_gzip_module and ngx_brotli modules — gzip on, gzip_comp_level, gzip_min_length, gzip_types and their brotli equivalents — from a set of checkboxes. It knows the real defaults (gzip level 1, minimum length 20 bytes, brotli level 6), keeps text/html out of the type lists to avoid nginx's duplicate MIME type warning, and flags settings that waste CPU for negligible size gains.
Open Nginx Compression Config Generator on AltFTool — it loads instantly in your browser.
Paste your code or data sample into the workspace.
Pick the format, conversion, or analysis you need.
Copy the polished result straight back into your project.
Levels and ranges match the nginx docs: gzip 1-9 (default 1), brotli 0-11 (default 6), gzip_min_length default 20.
text/html is always compressed by nginx, so the generator never repeats it in gzip_types or brotli_types.
Choosing gzip level 9 or a tiny min_length adds notes explaining the trade-off before you deploy it.
Level 5 or 6 is the usual sweet spot — nginx's default is only 1, and levels above 6 cost noticeably more CPU for roughly 1% smaller output. Level 9 only makes sense for pre-compressing static files offline, which gzip_static then serves with zero runtime cost.
Because nginx always compresses text/html when gzip is on — it is the built-in default for gzip_types — and listing it again makes nginx log a 'duplicate MIME type "text/html"' warning. The generator deliberately strips it from every type list.
Around 256 bytes or higher. The nginx default is 20 bytes, but responses smaller than roughly one TCP segment gain nothing from compression and very small payloads can even grow because of gzip's ~20-byte header overhead.
No — brotli requires the ngx_brotli module, installed as libnginx-mod-http-brotli on Debian and Ubuntu or compiled in with --add-module. Once loaded, brotli_comp_level 4-6 is recommended for on-the-fly compression, while level 11 is best kept for pre-compressed .br files served by brotli_static.