Safeguard
Developer Tools•

What are partitioned cookies (CHIPS) and when should you use them?

Partitioned cookies keep a separate cookie jar per top-level site, so embeds keep state without cross-site tracking. See the syntax, rules and use cases.

Safeguard Security Team
4 min read

A partitioned cookie, set with the Partitioned attribute under CHIPS, is stored separately for each top-level site that embeds your content. Your widget can keep its state on one site without being able to read that cookie when embedded on another, which blocks cross-site tracking.

The problem CHIPS addresses

Historically, if a page embedded a third-party iframe, that third party could set a cookie and read it again when embedded on any other site. MDN says this enables tracking of user activity across unrelated sites. CHIPS (Cookies Having Independent Partitioned State) lets a developer opt a cookie into partitioned storage, with a separate cookie jar per top-level site.

Partitioned cookies are double keyed: by the host that set them and by the site of the top-level page.

The syntax

Set-Cookie: __Host-example=34d8g; SameSite=None; Secure; Path=/; Partitioned;

MDN states that partitioned cookies must be set with Secure. It recommends the __Host prefix as well, to bind them to the current host rather than the registrable domain, unless you need to share between subdomains.

A worked example

Take a chat widget at a third-party host, embedded on two retail sites.

  1. A visitor opens the first site, and the widget sets a partitioned cookie. The storage key now includes that first site.
  2. The visitor opens the second site, which embeds the same widget. The widget cannot read the first cookie, because the partition key differs.
  3. Within the first site, the widget embedded on its subdomains, such as support and checkout, can still read the cookie, since the partition key is based on the site.

When to use it, and when not

SituationPartitioned cookie fits?
Embedded chat or support widget that keeps conversation state per siteYes
Embedded map that remembers preferences per embedding siteYes
CDN load balancing config per siteYes, per MDN
Single sign on that must recognise a user across different sitesNo, the cookie is invisible across top-level sites
Cross-site advertising identityNo, that is what partitioning prevents

MDN lists legitimate uses as persisting state of embedded maps or chat widgets across a domain and its subdomains, and config for subresource CDN load balancing and headless CMS providers.

Developer checklist

  1. Identify cookies your embedded service sets in a third-party context.
  2. Add Partitioned, keep Secure, and use SameSite=None since the cookie is sent in a cross-site context.
  3. Prefer a __Host- name unless subdomain sharing is needed.
  4. Test the embed on two different top-level sites to confirm state does not leak across.
  5. Test in a browser that partitions by default, since MDN notes Firefox's state partitioning differs: it partitions by default, while CHIPS is an opt in. Use the opt in so behaviour is consistent.

Partitioning is a privacy feature, not an authentication control. A partitioned session cookie should still be HttpOnly where scripts do not need it, and short lived.

For the first party side of cookie hardening, see secure cookie flags explained.

Quick check

Does Partitioned require Secure?

Yes. MDN says partitioned cookies must be set with Secure.

Can the same widget read its cookie on a different site?

No. The partition key is based on the top-level site, so a different site gets a different cookie jar.

Safeguard helps teams keep embedded and third-party components visible through SBOM and dependency scanning. Try the free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.