Cookie Store API
Reads and changes cookies asynchronously and gets change events, including in service workers.
In one line
Can watch and change the site's own cookies, but not hidden ones or other sites' cookies
Reads and changes cookies asynchronously and gets change events, including in service workers.
A site can watch and edit its own cookies without parsing document.cookie. It sees only non-HttpOnly cookies for its own origin.
What it can and can't do
What the user does: Nothing. It happens when the site's script checks or sets a cookie
It can
- List and change the site's own cookies that scripts may see
- Get a notice when its own cookies change, including in a background script
- Keep your sign in in step across tabs
It cannot
- See other sites' cookies
- See protected cookies marked HttpOnly
- Work from outside the site's own address
- Be sure to stop cookie syncing, which you stop by clearing cookies or blocking trackers
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 87 | 2020-11-17 | None |
| Edge | Supported | 87 | 2020-11-19 | None |
| Firefox | Supported | 140 | 2025-06-24 | None |
| Safari | Supported | 18.4 | 2025-03-31 | None |
| Safari on iPhone | Supported | 18.4 | 2025-03-31 | All iOS browsers use WebKit |
| Chrome on Android | Supported | 87 | 2020-11-17 | None |
| Samsung Internet | Supported | 14.0 | 2021-04-17 | None |
How a site asks for it
| API | cookieStore.get(), getAll(), set(), delete(); cookiechange event |
| Browser compat keys | api.CookieStoreapi.CookieStoreManager |
| How access is granted | none |
| What the user sees | None (no browser prompt) |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| Activation | none |
| How long it lasts | Same as the cookie lifetime |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | Same-origin and secure contexts only |
Typical flow
- Call cookieStore.set({name, value})
- Cookie stored
- cookiechange event fires in other tabs and service workers
Data you get
Shape: none
No individual data fields. The signal is the access itself.
Technical limits
- HTTPS only; cannot read HttpOnly cookies
- Cookie size limit 4096 bytes for name plus value; about 180 cookies per domain in Chrome, 50 per domain in Firefox (older), 150 in Safari
- Max Expires/Max-Age cap is 400 days in Chrome (Chrome 104)
- Third-party contexts follow normal third-party cookie blocking and the Storage Access API
- Support per MDN BCD: Chrome and Edge 87, Safari 18.4, Firefox 140
The story
What it is
A page can read and change cookies the modern way and hear about changes, even in background scripts.
For you
You never see it. Sites use it to remember your login and settings. If you clear cookies, the site will see the change.
For makers
Makers use it to manage login, consent choices and tracking IDs without blocking the page. Change events let them react when cookies are added or cleared. It works inside background scripts too.
Where you see it
| Type | Example | Apps |
|---|---|---|
| shopping | A store keeps your cart and login in cookies, and notices if they are cleared to rebuild your session. | None named |
| ads | An ad script watches for cookie changes and re-creates its ID if you clear it. | None named |
| analytics | An analytics tool reads and writes its visitor ID cookie, and sends a new event when it changes. | Google Analytics |
| games | A browser game portal stores your sign in and settings in cookies, and syncs across tabs. | None named |
| security | A bank page detects when its session cookie is removed and logs out the tab. | None named |
| news | A news site stores your cookie consent choices and reads them in the background scripts. | None named |
| video | A streaming site shares a login across tabs using cookie change events. | Netflix |
Risks
- Tracking IDs
- Hard to clear for good
What the platform says
- MDN Web Docs: Cookie Store API. Offers an async way to read and write cookies and to listen for changes, including in service workers.
Good uses and abuse
Legitimate uses
- Session sync across tabs
- Service worker session checks
Known abuse
- Cookie syncing and ID resurrection
- Persistent identifiers
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2020-11, Chrome 87: Cookie Store API ships
- 2022-08, Chrome 104: Cookie Max-Age and Expires capped at 400 days
- 2025-03, Safari 18.4: Cookie Store API ships in Safari
- 2025-06, Firefox 140: Cookie Store API ships in Firefox
Sources
How well checked: Based on official documentation.