Set up browser caching for faster repeat visits

Configure Cache-Control headers so returning visitors load your site from memory instead of the network.

What it means

Browser caching tells a visitor's browser to store a copy of your assets (images, CSS, JS) locally for a set period. On repeat visits, the browser loads those assets instantly from disk instead of downloading them again. For most sites, 60–80% of assets can be cached.

Why it matters

Repeat visitors are your warmest audience — subscribers, returning customers, people who bookmarked you. A slow repeat-visit experience loses real conversions. Caching also reduces your server and CDN bandwidth costs significantly.

How to fix it

  1. Set long cache durations (1 year) for versioned assets — files whose name or URL includes a hash or version number: Cache-Control: public, max-age=31536000, immutable
  2. Set shorter durations (1 hour to 1 day) for unversioned assets like your HTML, sitemap, and robots.txt: Cache-Control: public, max-age=3600
  3. Use a CDN (Cloudflare, Fastly, or your host's built-in CDN) — they cache at the network edge and serve assets from a location close to the visitor.
  4. If on Apache, add caching rules in .htaccess. On nginx, add expires directives. On Cloudflare, Rules → Cache Rules handles it without touching your server.
  5. Test your headers with Chrome DevTools → Network → select any asset → Headers tab → look for Cache-Control and Age.
  6. Verify with Google PageSpeed Insights — the 'Serve static assets with an efficient cache policy' audit lists every under-cached resource.

Helpful tools

Related guides