Connection failed. Please try again.

Skip to content
SEO Tools
Help and documentation
Speed Medium impact Easy 15–30 min

Browser caching

Static files should be stored at the visitor's end.

What it is

Browser caching (via Cache-Control / Expires headers) lets the browser store static files (images, CSS, JS, fonts) and not re-download them on the next visit.

Why it matters

Without caching, a returning visitor downloads everything again on every load — needlessly slow and data-heavy. Proper caching significantly speeds up repeat visits and offloads the server.

How to do it

  1. 1Set a long cache (e.g. 1 year) for immutable static files.
  2. 2Use "cache busting" — versioning in the name (app.4f3a.js) so the user gets the new version on change.
  3. 3Keep HTML with a short or no cache (it must be current).
  4. 4Verify the Cache-Control headers in the response.

Caching static files (.htaccess)

Correct
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
</IfModule>

Conclusion

Browser caching is a cheap way to speed up repeat visits. The key is combining a long cache for static assets + versioned names so you can change files without the risk of the user seeing an old version. Keep HTML fresh, on the other hand.

Related topics