Browser Caching & Compression Generator
Generate .htaccess and nginx rules for browser caching, GZIP/Brotli and keep-alive.
Loading tool…
About this tool
“Leverage browser caching” and “enable text compression” — the two most common speed audit failures — are both fixed with a few lines of server config. Pick your cache lifetimes per file type and get complete, copy-paste .htaccess (mod_expires + mod_deflate) and nginx rules, including sensible defaults used by fast WordPress sites.
How to use the Browser Caching & Compression Generator
- Choose cache lifetimes for images, CSS/JS and fonts (defaults are solid).
- Copy the generated .htaccess or nginx block.
- Add it to your server config and re-test with PageSpeed.
Frequently asked questions
What cache lifetime should I set?
Long (1 year) for versioned/hashed assets and images; shorter (hours–days) for HTML. The generator applies this pattern automatically.
Will caching break updates for returning visitors?
Not if your CSS/JS filenames change on deploy (most builders hash filenames). HTML itself is kept short-lived so pages always refresh.