Performance fix
How to Enable Gzip / Brotli Compression
Compress text responses (HTML, CSS, JS) so they transfer 60-80% smaller.
- Difficulty
- Medium
- Impact
- High
- Time
- 15 min
Before
# nginx: no compression configuredAfter
# nginx
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
brotli on;
brotli_types text/css application/javascript application/json;Text files like HTML, CSS and JavaScript compress very well, so serving them uncompressed wastes most of the bytes you send. Turn on Brotli or Gzip in your server or CDN, then confirm the response carries a content-encoding header. Transfer size usually drops by 60 to 80 percent with no change to your code.
Why it matters
Text-based files compress extremely well. Enabling Brotli or Gzip on the server cuts transfer size by 60-80% with no change to your code: one of the highest-leverage performance wins available.
How to fix it
Turn it on at the server
Enable Brotli (preferred) or Gzip in your web server / CDN for text MIME types.Verify the header
Check the response includescontent-encoding: br(orgzip) for HTML/CSS/JS.
The code
# nginx: no compression configured# nginx
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
brotli on;
brotli_types text/css application/javascript application/json;On your platform
WordPress
Most managed hosts enable this by default. If not, a caching plugin or your host's control panel can turn on Gzip/Brotli.
Next.js
Next.js gzip-compresses by default; if you sit behind nginx/Cloudflare, enable Brotli there instead.
Sources
Check your site with our free tool
HTTP Header Checker
More fixes
Performance
How to Minify Your CSS
Strip comments and whitespace from stylesheets to cut their size by 30-50%.
Performance
How to Minify Your JavaScript
Compress JS by removing comments, whitespace and shortening names: often a 40-60% reduction.
Performance
How to Lazy-Load Off-Screen Images
Defer images below the fold so they don't compete with the initial render.
Fixed that one.
Now find the rest.
A free audit ranks every issue on your site by the score points it costs, and links each one straight to its guide.
Run a free audit