What are third-party cookies?
Third-party cookies are cookies stored in your browser by another company than the website you visit. Advertising and analytics companies place them through code that many websites load. The same cookie recognises you on each of those websites and links your visits together.
On this page
What is a cookie?
A cookie is a small piece of text that a website stores in your browser. It holds a name and a value, such as a language setting or a login session. Your browser sends the cookie back with every later request to the same domain. That is how a website remembers that you are logged in or what is in your basket.
A server places a cookie with a header like this:
Set-Cookie: uid=8f3a2c91; Domain=ads.example; Max-Age=31536000; Secure
The uid is the name of the cookie and 8f3a2c91 its value.
The Domain decides which website may read the cookie back.
The Max-Age keeps it for one year, counted in seconds.
Cookies come in two kinds: session cookies and persistent cookies. A session cookie has no expiry date and normally disappears when you close the browser. A persistent cookie stays until its expiry date, which can be months or years away. Tracking cookies are persistent, so they still recognise you next week.
Only the domain that set a cookie can read it. A cookie from ultrablock.org cannot be read by google.com or facebook.com. This rule sounds strict, but third-party cookies work around it.
What is the difference between first-party and third-party cookies?
A first-party cookie comes from the website in your address bar, a third-party cookie from another domain. The file itself is the same. The difference is who sets it and where that company can read it back.
A third-party cookie arrives through an image, script or frame that the page loads from another company. That company sets the cookie for its own domain, not for the website you visit.
| First-party cookie | Third-party cookie | |
|---|---|---|
| Set by | The website you visit | Another domain that the website loads |
| Read by | That website only | The other domain, on every website that loads it |
| Typical use | Logins, baskets and language settings | Advertising, analytics and social buttons |
| Example | A web shop remembers your basket | An ad network recognises you on a news site and a web shop |
| When you block it | You are logged out and your basket is empty | Tracking across websites stops, some embedded services break |
First-party cookies are mostly harmless and often necessary. Third-party cookies cause the privacy problem, because they work across websites.
How do third-party cookies follow you across websites?
Third-party cookies follow you because the same company is loaded on many different websites. Each of those websites makes your browser contact that company, and your browser sends the cookie along.
It starts when you open a news site that loads a script from an advertising company. The advertising company sets a cookie with a unique identifier in your browser. A day later you visit a web shop that loads the same advertising company. Your browser sends the same cookie, so the company knows it is you again.
Each request also tells the company which page you are on. Over weeks, it collects a list of the articles you read and the products you viewed. That list becomes a profile of your interests. Advertisers use the profile to choose which ads you see and what they pay for them.
Social networks do the same through like buttons, share buttons and embedded posts. When you are logged in, they can connect your browsing to your own account. You never clicked anything, yet the network knows which pages you read.
A cookie is only one way to follow you. Read what a tracker is to see the other methods, such as tracking pixels and fingerprinting.
What do browsers do about third-party cookies?
Safari and Firefox limit third-party cookies by default, and every major browser lets you block them. The way they do it differs.
Safari blocks all third-party cookies by default since March 2020. Apple announced this on the WebKit blog with Safari 13.1, as part of Intelligent Tracking Prevention. A tracker on a website in Safari cannot read or set its cookie at all.
Firefox turned on Total Cookie Protection for all users by default in June 2022, according to Mozilla. It gives every website its own separate cookie jar. A tracker on a news site gets a different cookie than the same tracker on a web shop. The cookie still exists, but it can no longer connect your visits.
Chrome and Edge let you block third-party cookies in their privacy settings. Google has changed its plans for third-party cookies in Chrome several times since 2020. Check the setting in your own browser rather than relying on the default.
Blocking third-party cookies does not stop all tracking. The tracker still loads, still sees your IP address and can still use fingerprinting.
How do you block or remove third-party cookies?
You block third-party cookies in your browser settings and remove them by clearing stored cookies. Each browser keeps both options under privacy.
In Chrome and Edge, open the privacy settings and choose to block third-party cookies. In Firefox, open Enhanced Tracking Protection, choose Custom and block all third-party cookies. In Safari, third-party cookies are blocked already.
To remove tracking cookies you already have, clear cookies and site data in the same settings. This also logs you out of every website, because it deletes first-party cookies too. Blocking all third-party cookies can break embedded logins, comment sections and payment forms.
A tracker blocker works one step earlier. It stops the tracker from loading, so the tracker never gets the chance to set a cookie. Your logins and baskets keep working, because first-party cookies stay where they are.
See the cookies on every website
UltraBlock blocks the trackers that set third-party cookies and shows the cookies of every service it loads.
Block and remove third-party cookies
Frequently asked questions
Are third-party cookies dangerous?
No, a third-party cookie cannot run code or damage your computer. It only stores an identifier. The risk is privacy: the identifier lets one company connect your visits to many websites.
Does deleting cookies stop tracking?
No, deleting cookies only resets the identifier. Trackers still load on the next page, still see your IP address and can use fingerprinting instead of a cookie.
Will blocking third-party cookies break websites?
Sometimes. Embedded logins, comment sections and payment forms can rely on a third-party cookie. Most other websites keep working, because logins and baskets use first-party cookies.
Do websites need my consent for third-party cookies?
In the European Union, yes. The ePrivacy Directive (2002/58/EC, amended in 2009) requires consent before a website stores cookies that are not strictly necessary. In the Planet49 case of 2019, the Court of Justice of the EU ruled that a pre-ticked box is not valid consent.
How do I remove tracking cookies?
Clear cookies and site data in the privacy settings of your browser. This removes tracking cookies, but also logs you out of every website. Blocking third-party cookies afterwards stops new tracking cookies from being stored.