Zstandard (zstd) Compression — Enable It in Nginx, Vercel and Cloudflare
Updated April 2026
Brotli replaced gzip as the go-to web compression in 2020. Zstandard (zstd) is the next step — faster to compress and decompress, with better ratios on most web assets. Chrome and Firefox both support it now. Here is how to enable it.
Check what compression you are serving today
curl -H "Accept-Encoding: zstd, br, gzip" -I https://yoursite.com/ | grep -i content-encoding # If you see: content-encoding: zstd — you already serve zstd # If you see: content-encoding: br — you serve Brotli (good, step up to zstd) # If you see: content-encoding: gzip — time to upgrade
Nginx — enable zstd
Nginx does not include zstd support by default. You need the ngx_http_zstd_module:
# Ubuntu/Debian — install the module
sudo apt install nginx-module-zstd # if available in your repo
# or compile from source with --add-module=/path/to/ngx_http_zstd_filter_module
# nginx.conf — load the module
load_module modules/ngx_http_zstd_filter_module.so;
http { zstd on; zstd_comp_level 3; # 1-22, 3 is the sweet spot for speed/ratio zstd_types text/html text/css text/javascript application/javascript application/json application/xml text/plain;
}
# Your server still serves Brotli and gzip as fallbacks via content negotiation
brotli on;
brotli_comp_level 4;
gzip on;
gzip_comp_level 6;
Vercel — zstd status
Vercel's edge network handles compression automatically. If the client browser sends Accept-Encoding: zstd, Vercel serves zstd if available. You do not configure this — it happens at the edge layer. Check the actual response:
curl -H "Accept-Encoding: zstd" -I https://yourapp.vercel.app/ | grep content-encoding
Cloudflare — automatic zstd
Cloudflare enables zstd automatically for browsers that support it. No configuration needed. If you are behind Cloudflare, your users with Chrome 118+ and Firefox 126+ are already receiving zstd.
Apache — zstd compression
# Install mod_brotli and the zstd extension # Ubuntu: sudo apt install libapache2-mod-zstd # if available # .htaccess or httpd.conf AddOutputFilterByType ZSTD_COMPRESS text/html text/css application/javascript application/json
How the browser negotiates
# Browser sends in request: Accept-Encoding: zstd, br, gzip, deflate # Server responds with the best it supports: Content-Encoding: zstd # if server supports zstd Content-Encoding: br # fallback to Brotli Content-Encoding: gzip # fallback to gzip # If no Accept-Encoding match, server sends uncompressed
Real-world compression comparison
| Algorithm | Compression speed | Decompression speed | Ratio vs gzip | Browser support 2026 |
|---|---|---|---|---|
| gzip | Fast | Fast | Baseline | Universal |
| Brotli | Slow (precompressed) | Fast | ~15-20% better | All modern browsers |
| Zstd level 3 | Very fast | Very fast | ~15-20% better | Chrome 118+, Firefox 126+, not Safari |
| Zstd level 10+ | Slow | Very fast | ~20-25% better | Same as above |
Use EdgeFix to check what Content-Encoding your server is actually returning and whether your Vary header is set correctly to allow CDN caching of compressed variants.