Websites and Tech

Browser Cache

Also called browser caching, clear cache

Copies of a website's files saved on a visitor's own device so pages load faster on later visits; how long they are kept is set by the server.

Quick facts: Browser Cache

Category
Websites and Tech
Also called
browser caching, clear cache
Level
Beginner
Affects
Repeat-visit speed, bandwidth use, how quickly visitors see updates
Where to see it
Chrome developer tools (Network tab), PageSpeed Insights, caching plugin or CDN settings
In this article4
  1. How the browser cache works
  2. Why it matters
  3. Common mistakes
  4. How to act on it

The browser cache is a store of website files, such as images, stylesheets, scripts and fonts, that a visitor’s browser keeps on their own phone or computer after the first visit. Next time a page needs the same file, the browser uses its saved copy instead of downloading it again, so the page appears faster.

How the browser cache works

Your server decides what may be kept and for how long by sending instructions with every file, in what are called HTTP headers. The main one is Cache-Control. A value such as max-age=31536000 tells the browser it can reuse the file for a year without asking; no-cache tells it to check with the server first. When a browser checks, the server can reply “not modified” in a few bytes instead of resending the whole file.

A sensible set-up treats files differently. Logos, fonts, stylesheets and scripts change rarely, so they get long lifetimes. The HTML of each page changes whenever you edit it, so it is usually kept briefly or checked every time.

Long lifetimes raise an obvious question: what happens when you do change the stylesheet? The answer is versioning. Well-built sites give each version of a file a different name, for example style.css?ver=4.2 or a file name with a code in it. When the file changes, the name changes, and every browser fetches the new one straight away. WordPress, Shopify and most modern build tools do this automatically for their own files.

The browser cache is only one layer. Your server may also keep ready-made pages, and a CDN may hold copies nearer the visitor. The wider caching entry explains how the layers fit together.

Why it matters

Most visitors see more than one page, and many come back. With good cache rules, the second page of a visit downloads only what is new, which feels noticeably quicker on a patchy mobile connection on a train. It also reduces the data your host sends, which can matter on plans with a bandwidth limit.

Google’s PageSpeed Insights reports static files with short cache lifetimes, so weak cache rules are an easy, measurable improvement. The cache also explains a common frustration: you update the website, but you or your client still see the old version. That is usually your own browser showing its saved copy.

Common mistakes

  • Sending no cache headers at all, so every page view downloads the same logo and fonts again.
  • Setting long lifetimes without versioned file names, which leaves visitors stuck with an old stylesheet for weeks.
  • Allowing pages with personal content, such as a basket or account page, to be stored and reused.
  • Telling customers to “clear their cache” rather than fixing the versioning that caused the problem.
  • Confusing clearing the cache with clearing cookies, which also logs you out of sites.

How to act on it

When you cannot see a change you have just made, do a hard refresh first: Ctrl+Shift+R on Windows or Cmd+Shift+R on a Mac. If that shows the new version, the site is fine and only your browser was out of date.

To check your cache rules, open the developer tools in Chrome, go to the Network tab, reload the page and click on an image or stylesheet. The response headers show its Cache-Control value. Static files should normally have long lifetimes; pages with personal information should not be stored.

Rules are set in your hosting configuration, a caching plugin or your CDN, depending on the platform. If PageSpeed Insights keeps flagging cache lifetimes, or edits are slow to appear for visitors, it is worth fixing properly. Cache headers are one of the checks in my technical SEO audits.

Do and do not

Do

  • Give static files long cache lifetimes
  • Version file names so updates show immediately
  • Hard refresh before reporting a missing change

Do not

  • Store pages that contain personal details
  • Set long lifetimes without versioning
  • Ask customers to clear their cache as a fix

Questions people ask about this

Is it safe to clear my browser cache?

Yes. Clearing the cache only deletes saved copies of website files, and your browser downloads fresh ones as you browse. Pages may load a little slower at first. Be careful not to tick cookies or saved passwords at the same time unless you mean to, because that logs you out of websites.

Why can my customer still see the old version of my website?

Their browser, or a server or CDN cache, is probably showing a saved copy. Ask them to do a hard refresh. If the problem keeps happening after updates, the site's files are not being versioned properly or a server cache is not being cleared when you publish, and a developer should fix that at source.

How long should files stay in the browser cache?

Files with versioned names, such as stylesheets, scripts and fonts, can safely be kept for up to a year, because a change gives them a new name. Images that rarely change can also be kept for months. Page HTML is usually kept briefly or checked with the server each time, so visitors see your latest content.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.