← Blog 5 min read

Clear-Site-Data: How Websites Reset Local Data

Clear-Site-Data: How Websites Reset Local Data

Websites can store cookies, cached files, databases, service workers, and other local state in your browser. Usually, a site removes individual items with the same APIs that created them. The web also provides a stronger reset mechanism: an HTTP response header called Clear-Site-Data.

The header lets a server ask the browser to clear selected categories of data associated with that site. It can support a complete logout, recovery from corrupted local state, or a privacy-focused account reset. It is powerful, but it is not the same as manually clearing all browsing data.

How the header reaches the browser

A server includes Clear-Site-Data in an HTTPS response. The value contains one or more quoted directives, such as "cookies", "storage", or "cache". The quotes are part of the required syntax. A supporting browser processes the requested categories before presenting the response.

MDN documents the available directives and notes that the feature works only in secure contexts. A random insecure page should not be able to issue a trusted cleanup command for stored site data.

What the cookies directive clears

The "cookies" directive asks the browser to remove cookies for the relevant registered domain, including associated subdomains. It can also clear HTTP authentication credentials. This scope is broader than deleting one session cookie with an expired Set-Cookie header.

That breadth is useful during a full logout or security reset, but developers need to plan for it. Different applications under the same parent domain may rely on related cookies. A cleanup endpoint should not unexpectedly sign the user out of unrelated services unless that is the intended result.

What storage includes

The "storage" directive targets DOM-accessible storage associated with the origin. That can include localStorage, sessionStorage, IndexedDB, Cache Storage, and service-worker registrations. Browser implementations and evolving standards determine the exact coverage.

Storage often contains offline content, application preferences, cached account data, or queues waiting to synchronize. Clearing it can repair a broken app, but it may also remove drafts or offline progress. Sites should communicate the consequence before offering a user-facing reset.

Cache clearing has a narrower boundary

The "cache" directive asks the browser to remove locally cached resources tied to the response origin. This can force fresh copies of scripts, styles, and images on later visits. Depending on implementation, additional internal caches may also be affected.

It does not purge every shared intermediary between the browser and the website. MDN's HTTP caching guide explains that the directive affects browser caches, not necessarily proxy or content-delivery-network caches.

What execution contexts mean

The experimental "executionContexts" directive asks the browser to reload active pages for the origin. Without that step, another open tab might continue running code with an older in-memory view of the account or application state.

Support varies, and the behavior can be disruptive. A reload may interrupt unsaved work. Developers should not assume that every browser supports every directive merely because the base header is available.

The wildcard is deliberately broad

A value of "*" asks the browser to clear every category recognized by the header, including categories added in the future. The W3C Clear Site Data specification recommends the wildcard for a genuinely broad cleanup rather than as a shortcut for a fixed list.

That future-facing behavior is important. A developer who wants exactly cookies and storage should name those two categories. A developer who wants a complete origin reset can use the wildcard with the understanding that its reach may grow as browsers add storage mechanisms.

How this differs from clearing browser data yourself

When you use the browser's settings, you choose the time range and categories, often across many sites. A Clear-Site-Data response is scoped to the site that sends it and the directive categories it names. It cannot erase unrelated browsing history across the web.

Our guide to clearing browser data covers the user-controlled workflow. The header is an application-controlled cleanup signal. Both rely on the browser's implementation, and neither should be described as a forensic guarantee that no remnants exist anywhere on disk or in backups.

When a site should use the header

A security-sensitive logout

An ordinary logout can invalidate the server session and expire authentication cookies. A broader cleanup can also remove local application state that should not remain available to the next person using a shared computer.

Account deletion or device removal

After an account is deleted, the site may want to remove local databases, cached account views, and service workers. The server must still delete or retain server-side records according to its policies and legal duties; clearing the browser is only the client side.

Recovery from corrupted state

A bad service worker or incompatible database migration can make an application fail repeatedly. A carefully designed reset route can clear the problematic categories and return the user to a clean start.

Privacy limits worth understanding

The header does not contact third parties and command them to delete copies of data they already received. It does not erase server logs, account records, or analytics databases. It also does not replace tracker blocking, which prevents some requests before information leaves the browser.

Stored state is only one part of recognition. A site can still observe an IP address and browser characteristics on the next visit. Read our browser fingerprinting guide and tracker-blocking overview for those separate layers.

A useful reset with a clear scope

Clear-Site-Data gives websites a standardized way to ask the browser for a clean local slate. Used carefully, it makes logout, deletion, and recovery more complete. Its value comes from precision: clear the necessary categories, explain user-visible consequences, and remember that local browser cleanup is only one piece of responsible data handling.

Browse with more intention

Noorani brings prayer times, Qibla, tracker blocking, and privacy into one calm desktop browser built for how Muslims live online.

Download Noorani