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
- 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
- Set shorter durations (1 hour to 1 day) for unversioned assets like your HTML, sitemap, and robots.txt: Cache-Control: public, max-age=3600
- 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.
- If on Apache, add caching rules in .htaccess. On nginx, add expires directives. On Cloudflare, Rules → Cache Rules handles it without touching your server.
- Test your headers with Chrome DevTools → Network → select any asset → Headers tab → look for Cache-Control and Age.
- Verify with Google PageSpeed Insights: the 'Serve static assets with an efficient cache policy' audit lists every under-cached resource.
Helpful tools
- Chrome DevTools → Network tab
- PageSpeed Insights
- Cloudflare Cache Rules
Not sure if this affects your site? Analyze your website for free or compare it with a competitor.
Related guides
- Largest Contentful Paint (LCP): What It Is and How to Fix It: Make the biggest visible element on your page load in under 2.5 seconds.
- Stop layout shifting (CLS): Reserve space for images and embeds so the page stops jumping while loading.
- Reduce Total Blocking Time (TBT): Break up long JavaScript tasks so the page stays responsive to taps and clicks.
- Improve mobile page performance: Cut image weight, JavaScript, and server lag so the page loads fast on phones.