Clear Cache Clear Cache
Add to Chrome — Free

Clear Cache Blog

Cache Busting Explained: How Websites Force Cache Updates

Updated March 2026 · 8 min read

Quick Answer Cache busting is how developers force browsers to download updated files instead of using old cached versions. The most reliable method: append a content hash to filenames (main.a3f7c9.js). When the file changes, the hash changes, making it a new URL that bypasses cache automatically. If a website isn't using cache busting properly, users may need to manually clear cache to see updates.
📋 Table of Contents
📋 Table of Contents

If you've ever deployed a website update and wondered why users still see the old version — or why you need to tell users to "clear their cache" after a release — the answer is that your caching strategy needs work. Cache busting is the systematic solution. This guide explains what cache busting is, the technical approaches, their tradeoffs, and when each is appropriate.

Stuck Seeing Old Site Content? Clear Your Cache Now

If a website hasn't implemented proper cache busting, you may need to manually clear your browser's cache to see the latest version. The Clear Cache extension handles this in one click.

Add to Chrome — Free


The Problem Cache Busting Solves

Browser caching is intentional — it makes websites faster by storing files locally so they don't need to be re-downloaded on every visit. Browsers follow cache headers set by the server. If a server sets:

Cache-Control: max-age=31536000

...the browser will use the cached copy of that file for up to one year without re-checking the server.

This creates a problem when files change. Your HTML might reference the new styles.css, but users' browsers already have the old styles.css cached. The browser serves the old version, the layout looks broken, and your carefully deployed update looks like a regression.

The fundamental tension: you want static files cached aggressively (for performance), but you need users to get updates immediately when files change. Cache busting resolves this by making each version of a file have a unique URL.



Method 1: Filename Versioning

The simplest approach: include a version number in the filename itself.

styles.v1.css → styles.v2.css
main.v1.0.js → main.v1.1.js

When you deploy an update, you change the filename and update the HTML reference. The browser has never seen this URL before, so it downloads it fresh regardless of cache settings.

Pros: Simple to implement manually, works for small sites, no build tool required

Cons: Manual — easy to forget to update, doesn't scale to many files, version numbers become meaningless without a changelog



Method 2: Content Hashing (Recommended)

Modern build tools (Webpack, Vite, Parcel) automatically generate a hash of each file's contents and include it in the filename:

styles.a3f7c9d2.css
main.bundle.8e2f1a44.js

The hash is deterministic: the same file content always produces the same hash. When a file changes, its hash changes, making a new filename that the browser has never cached.

This allows long cache lifetimes (max-age=31536000 — one year) for hashed assets, since the URL itself changes whenever the content changes. The HTML file that references these assets has a short cache lifetime or no cache, ensuring it's always current.

Pros: Fully automatic when configured in build tools, no manual version tracking, works perfectly with CDNs, allows aggressive caching of static assets

Cons: Requires a build tool, doesn't work for files referenced outside the build system (like images in a CMS)

Build ToolContent Hashing Configuration
Webpackoutput: { filename: '[name].[contenthash].js' }
ViteEnabled by default in production builds
ParcelEnabled by default in production mode
Rollupoutput: { entryFileNames: '[name]-[hash].js' }
GulpUse gulp-rev plugin to append hashes


Method 3: Query String Versioning

Append a version parameter to the file URL without changing the filename:

<link rel="stylesheet" href="styles.css?v=2.1.0">
<script src="main.js?v=2.1.0"></script>

The browser considers styles.css?v=1.0 and styles.css?v=2.0 as different URLs and downloads both.

Pros: Easy to implement (just update the version string), works without a build tool, preserves human-readable filenames

Cons: Some CDNs and proxy servers ignore query strings and treat the URL as the same resource regardless of parameters. This is a significant limitation — CDN caches may not bust properly, and users behind corporate proxies may still get old files even after you update the version parameter.

Query strings and CDNs: If you're using a CDN (Cloudflare, CloudFront, Fastly), test whether query strings are included in the cache key. Many CDN configurations strip query strings by default, meaning styles.css?v=1 and styles.css?v=2 return the same cached response. Use filename-based versioning for CDN-served assets to avoid this issue.


Method 4: HTTP Cache Headers (ETag and Last-Modified)

Rather than changing URLs, these methods use HTTP headers to let browsers check if a cached file is still current:

ETag (Entity Tag)

The server sends a unique identifier (hash) for the current version of a file:

ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"

On subsequent requests, the browser sends If-None-Match: "33a64df...". If the file hasn't changed, the server responds with 304 Not Modified and the browser uses its cached copy. If the file changed, the server sends the new version with a new ETag.

Last-Modified

The server sends the file's modification timestamp. On subsequent requests, the browser sends If-Modified-Since. Similar conditional request/response pattern to ETag.

Pros: Automatically handles any file changes without modifying URLs, transparent to both server and browser

Cons: Requires a network request to validate (even if the file hasn't changed), slower than content-hashed filenames for unchanged files



The Optimal Caching Strategy

Modern best practice combines aggressive caching with content hashing:

Hashed static assets — cache for 1 year Files like main.a3f7c9.js and styles.8e2f1a.css get Cache-Control: max-age=31536000, immutable. If the content changes, the hash changes and the filename changes — so the 1-year cache is never stale.
HTML files — no cache or short cache Cache-Control: no-cache or Cache-Control: max-age=0, must-revalidate for HTML. The HTML is always revalidated against the server, ensuring it references the latest hashed assets.
Service worker — network first or stale-while-revalidate If you use a service worker, configure its caching strategy carefully. Service worker cache operates independently of browser cache and requires explicit update logic.


Why Users Still Sometimes Need to Clear Cache

Even with good cache busting, users occasionally need to clear cache manually. Common reasons:

If your users frequently need to clear cache: This is a signal that your cache busting implementation has gaps. Every "please clear your cache" request from a developer to a user is a developer problem to solve, not a user education problem. Implement proper content-hash-based cache busting and the manual clearing requests should stop.

Users: One Click to Clear Any Site's Cache

When a website update isn't showing through because of stale cache, the Clear Cache extension clears it instantly without clearing your other sites' data.

Install Clear Cache — Free


Service Worker Cache: The Persistent Layer

Service workers introduce a cache layer that operates independently from standard browser HTTP cache — and which requires explicit application logic to update. If a site has a service worker with aggressive caching:

Service worker cache clearing requires special steps: navigating to chrome://settings/content/all, finding the site, and clearing all stored data including service workers — or the developer implementing an update notification UI.



Frequently Asked Questions

What is cache busting?

Cache busting is a technique that forces browsers to download a new version of a file instead of using the cached version. It works by changing the file's URL when content changes — via a version number, content hash, or timestamp added to the filename or URL. When the URL changes, the browser treats it as a new resource and downloads it fresh.

What are the main cache busting methods?

The main methods: (1) File name versioning — include version in the filename (styles.v2.css), (2) Content hash — append a hash of file contents to the filename (styles.a3f7c9.css), (3) Query string — append a version parameter (?v=2.1), (4) ETag headers — server sends a unique identifier for conditional requests. Content hashing is the most reliable modern approach.

Why does cache busting matter for website updates?

Without cache busting, browsers keep using old cached CSS, JavaScript, and images after a site update. This causes broken layouts and JavaScript errors because old code runs against new HTML. Cache busting ensures every user's browser gets the version of each file that matches the current HTML structure.

Does adding ?v=timestamp to CSS files work for cache busting?

In most browsers yes, but some CDNs and proxies ignore query strings and cache the URL as if the parameter doesn't exist. For CDN-served assets, filename-based cache busting (changing the actual filename) is more reliable because different filenames are always treated as different resources.

When should a user clear cache vs a developer using cache busting?

Cache busting is what developers implement so users never need to clear cache manually. When properly implemented, all updates reach users automatically. User-side cache clearing is only needed when cache busting wasn't implemented, there's a caching bug, or a service worker is serving stale content. Frequent user requests to clear cache signal a developer problem to fix.

More Free Chrome Tools by Peak Productivity

Bulk Image Downloader
Bulk Image Downloader
Download all images from any page
YouTube Looper Pro
YouTube Looper Pro
Loop any section of a YouTube video
Citation Generator
Citation Generator
Generate APA/MLA/Chicago citations
PDF Merge & Split
PDF Merge & Split
Merge and split PDFs locally
WebP to JPG/PNG
WebP to JPG/PNG
Convert WebP images to JPG/PNG
Screen Recorder Pro
Screen Recorder Pro
Record your screen or tab with audio