What is a cache?

Updated at: May 20, 2024

A web browser cache is a collection of files that your web browser has already downloaded for a website, and which it uses to make browsing the internet faster for you.

Here's how a cache makes your web browsing experience better:

Your web browser needs lots of files to show you a web page

Every single time you look at a web page on the internet your web browser needs a number of files to actually show you the page properly - it has to download:

  • the words on the the page
  • the images on the page
  • how the page "looks" (ie. the colors, layout of the page, the size of the text etc)
  • any special fonts used for the text
  • any code that runs on the page
  • any videos or sounds on the page

and so on.

Depending on the speed of your internet connection and the size & complexity of the page, downloading all of this data can take a bit of time.

Most of these files are re-usable

All the different pages on a website tend to share the same look and feel - if you explore a website it's very common that the same logo, background images, colors and fonts, etc will be reused on all the pages of the same site. So there's no need for your web browser to keep downloading them over and over again!

Your browser automatically stores them

The first time you visit a website, your web browser will store the logos, colors, fonts, code - and so on - in a cache - which is a collection of temporary files.

Your browser re-uses those files from the cache

When you you open another page on the same website, your web browser will load as many of the logos, colors, fonts, etc as it can from the cache on your computer or phone instead of re-downloading them.

Using the cache makes using the website much faster, and it also saves you wasting your data.

New files are still downloaded as required

While a website typically uses the same logo, fonts, and styles on each page, most pages also have some different files on them as well - think of a site like Youtube - every page looks basically the same - the same logo, fonts, and layout - but each page also has different text, videos, thumbnails, and comments on them.

So when you load a second page, because of the web browser cache stored on your device, your browser won't have to download the logos, fonts, again, but it will still have to load the different text, images, and videos for the second page.

But by loading as much as your browser can from the cache, it doesn't need to keep downloading the same files over and over again, and this makes it much faster to load the second, third, and other pages.

Those new files are cached as well, so if you go back to a page that you've already visited it will usually load a lot faster the second time.

The cache is different to "saving a file" from a website

When your web browser caches a site the process is totally automatic, and you don't have to do anything for it to happen. It's also different to when you "save an image" or "download a file" to your device.

When you download a file from a website your browser will ask you where you want to save the file, what you want to name it, and so on. Your web browser's cache is not the same as that. Your browser stores the files for the website in a special place on your computer and only accesses them when you load another page on the site.

The cache is similar to "cookies" and "browser history"

Your browser cache might sometimes be mentioned in the same breath as your "cookies" and your "browser history" - and while they are similar in some ways, they are technically different things.

Cookies are small bits of information that websites can store on your computer that help it remember something about you (Read: Why do websites use cookies?). Your browser history is a list of the websites that you have visited recently.