Cookies vs Cache

Cookies are small pieces of data a website asks your browser to store about you — for sign-in sessions, preferences, and tracking. Cache is files (images, scripts, stylesheets) the browser saves locally so it doesn't have to download them again next time you visit. Both live in the browser, both can be cleared, and they do entirely different things.

Last reviewed on 2026-04-27.

Quick Comparison

AspectCookiesCache
JobStore information about you for a siteStore website files for faster reloads
Set byServer, via response headersBrowser, automatically as files are downloaded
Sent backYes, with every request to the same siteNo — files are read locally on demand
SizeSmall (a few KB at most per cookie)Large — can be many MB or GB
LifespanSet by the server; minutes to yearsUntil evicted; browsers cap total cache size
Privacy implicationHigh — used for tracking and personalisationLow — but cache files can include third-party content
Safe to clear?Yes — you'll be signed out of sitesYes — sites will reload more slowly the first visit afterwards

Key Differences

1. What they're for

Cookies hold information about you that the server can read across requests: a session ID after login, a language preference, an A/B test bucket, a tracking ID for ads.

Cache holds the website's own files locally. CSS, JavaScript, images, fonts — anything the server says is cacheable. The browser uses these files instead of downloading them again.

2. Direction of travel

Cookies ride round-trip. The server sets a cookie via a response header, and the browser sends it back on every subsequent request to the same domain.

Cache is local. The server doesn't see your cache; the browser just reads from disk when a file is already there and still valid.

3. Size

Cookies are small. Browsers limit total cookies per site, and individual cookies must be under a few kilobytes.

Cache can be large. Browsers cap the total but it can be many gigabytes — videos, images, app shells.

4. Lifetime

Cookies have an explicit expiration set by the server. Session cookies vanish when you close the browser; persistent cookies can last days or years.

Cache entries are kept until the browser evicts them (out of space, age, server cache headers say to revalidate). They're not designed to last forever.

5. Privacy implications

Cookies are central to ad tracking. Third-party cookies (set by domains other than the one you're visiting) are how ad networks built profiles. Modern browsers increasingly block third-party cookies by default.

Cache is a smaller privacy issue, but cached content can include third-party scripts and images. Cache-based fingerprinting (timing how fast a resource loads) has been used and is mitigated by browsers.

6. When to clear each

Clearing cookies signs you out of every site. It also resets ad-tracking IDs (until they re-find you). Useful for fresh starts and troubleshooting login problems.

Clearing cache forces the next visit to redownload everything. Useful when a site appears stale (you keep seeing an old version) or after a site update doesn't show.

When to Choose Each

Choose Cookies if:

  • Sign-in sessions, preferences, language settings, shopping carts.
  • Server-side analytics that need to recognise returning users.
  • Ads and personalisation (with appropriate consent).
  • Anywhere the server needs persistent state attached to a browser.

Choose Cache if:

  • Speeding up repeat visits — pages load far faster when assets are local.
  • Allowing offline-capable web apps to function without a network.
  • Reducing bandwidth use, both yours and the server's.
  • Improving Core Web Vitals scores by avoiding redundant downloads.

Worked example

You sign in to a site. The server sets a session cookie; the browser sends it on every subsequent request, so the site recognises you. The site's logo, fonts, CSS, and JavaScript come down once and the browser caches them — the second page on the same site loads almost instantly because everything except the new HTML is already on disk. Sign out and the cookie is cleared; the cache stays, so a future first page still feels fast.

Common Mistakes

  • "Cookies and cache are the same thing." They're both browser storage but with different jobs and different privacy profiles.
  • "Clearing cache will sign me out." It won't — that's clearing cookies. Cache holds files, not session state.
  • "Cache is what tracks me." Tracking is mostly cookies (and increasingly server-side identifiers). Cache plays a small, indirect role.
  • "Always block all cookies." Aggressive blocking breaks sign-ins and many normal site features. Blocking third-party cookies is a more useful default.