What Are Cookies? How Websites Track You With Cookies and How to Block Tracking
What are cookies, and why does every website ask you to “Accept cookies”? A cookie is a small piece of data a website stores in your browser so it can remember you. That's convenient, but it's also how ad companies follow you from site to site. This article explains how cookies work, how first-party and third-party cookies differ, and how to cut down on tracking while still browsing normally.
What are cookies?
A cookie is a small piece of data that a website stores in your browser when you visit. Think of it as a “memory card” that helps the site remember who you are, what you did on the page, and choices such as language or display settings (dark mode, layout, and so on). A few examples:
- Staying signed in: when you log in to facebook.com, the site asks your browser (Chrome, Firefox, etc.) to store several cookies, including one containing a
session_id, a code that represents your login session. Every time you come back, the browser sends this cookie along, so you don't have to log in again. - Shopping cart: on an online store, the items you add to your cart can be saved in a cookie, so they're still there the next time you visit.
- Display preferences: when you pick a language such as Spanish and turn on dark mode, that choice can be stored in a cookie so you don't have to set it again.
What information do cookies contain?
- User identifiers (User ID / Session ID): so you don't have to log in on every visit.
- Language and layout choices: so you don't have to customize the site again.
- Product or page viewing history: used for shopping carts or recommendations based on past behavior.
- Ad company tracking IDs: used to study user behavior and show “relevant” ads.
Cookies are not malware, but they can be exploited to track what users do.
First-party vs. third-party cookies: what's the difference?
| First-party cookies | Third-party cookies | |
|---|---|---|
| Created by | The website you are visiting | Other services embedded in the page: ad networks, trackers, analytics systems |
| Main purpose | Keeping you signed in, shopping cart, language, layout | Tracking behavior across websites, building ad profiles |
| Scope | Only that website | Every website that embeds the same tracker |
| What if you block them? | Many sites can't keep you signed in or remember your cart | Most sites keep working normally |
First-party cookies
These are cookies that the website you're visiting asks your browser to remember. For example:
- You visit a website and add a few products to your cart.
- The website saves the products you chose in a cookie right in your browser.
- You choose Spanish as the language, and the website remembers it by storing it in a cookie.
- Next time you come back, the content is in Spanish and your cart still has the products.
This is the most common type of cookie, used mainly to improve the user experience.
Third-party cookies
These cookies serve tracking purposes and come from other sites embedded in the website, usually advertising systems or user-behavior tracking systems (trackers).
How do websites track you with cookies?
Imagine three websites:
websiteA.com— sells sneakerswebsiteB.com— books travel tourswebsiteC.com— sells laptops
All three often embed ad code or trackers from an ad company, such as Google Ads, Meta Pixel, or Google Analytics. When you visit websiteA.com, the tracker creates a cookie in your browser like user_id = XXXXXXXX. This cookie is a unique identifier that lets the advertiser recognize your browser across many websites. When you visit other sites using the same tracker:
- Website A records that you're looking at running shoes.
- Website B records that you're searching for beach holiday tours.
- Website C records that you're browsing gaming laptops.
Because all three use the same ad system, the tracker recognizes user_id = XXXXXXXX as the same person. Data from many websites is stitched together into a detailed ad profile of you, which may include:
- Interests: sports, technology, travel
- Expected spending level
- The device you use
- Where you live
- When you're active online
This profile is used to show personalized ads, track behavior, or run marketing analytics. Scammers running ads can also use these systems to target exactly the right people. See how scam ads target you.
Why are cookies a privacy concern?
Cookies can be used to:
- Track your browsing history
- Analyze your habits
- Build ad profiles
- Analyze your location and device
This data may be shared with advertising partners or social networks to optimize ad delivery. The more personal information is exposed, the easier it is for scammers to craft a scheme aimed squarely at you. See also habits that leak your personal data. Around the world, tech giants, social networks, and advertisers have faced numerous lawsuits over privacy violations. That's why understanding cookies is essential to protecting your privacy online.
Another risk: stolen login cookies
A login session cookie (session_id) is almost as valuable as a password: anyone who has it can get into your account without the password or OTP code until the session expires. Some types of information-stealing malware (infostealers) are designed specifically to grab cookies from browsers. So:
- Only install software and extensions from official sources. See how to spot malicious apps.
- Click Log out when using a public computer or someone else's device.
- If you suspect your account has been hijacked, use “sign out of all devices” and then change your password. This usually invalidates old session cookies.
Common misconceptions about cookies
Cookies cannot:
- Eavesdrop through your microphone
- Read files on your computer
- Control your device
Cookies are just small pieces of text in your browser. The real risk is that trackers and advertisers combine the data they collect to build large-scale user profiles and use them for other purposes, along with the risk of login cookies being stolen, as described above.
Should you click “Accept” or “Reject” on cookies? When a site shows a cookie consent banner, you can choose “Reject” or “Necessary cookies only.” The site still works, but advertising and tracking cookies are limited.
How to limit cookie tracking in a regular browser
Technically, you can always manage cookies in your browser, but most people don't know what to do. Here are ways to reduce what cookies reveal about you while still using the Internet normally. Menu names may vary by browser version.
1. Block third-party cookies
Third-party cookies are created by ad networks, trackers, or analytics systems and let them follow you across websites. Turning on third-party cookie blocking helps limit this:
- Google Chrome (desktop): Settings → Privacy and security → Third-party cookies → choose to block.
- Google Chrome (Android): Settings → Site settings → Third-party cookies.
- Firefox: Enhanced Tracking Protection under Privacy & Security.
- Safari (iPhone, Mac): turn on Prevent Cross-Site Tracking.
2. Use incognito / private mode
Incognito mode doesn't keep your browsing history, cookies, or temporary login data after you close the window, which makes it harder for trackers to build a long-term profile on your device.
However, incognito does not make you “completely anonymous”: your carrier, Internet provider, websites, and trackers can still see part of your activity.
3. Clear cookies regularly
Cookies can store identifiers for a long time, sometimes months or even years. Clearing cookies regularly wipes old identifiers, reduces continuous tracking, and breaks up ad profiles built earlier. Note: clearing cookies signs you out of websites.
4. Block trackers
Trackers are snippets of code embedded in websites to collect behavioral data. They can record the pages you visit, how long you stay, what you click, and build a personal ad profile. You can use:
- Your browser's built-in anti-tracking features
- Tracker-blocking extensions
- Privacy-focused browsers
Popular tools include SafePhone, uBlock Origin, Privacy Badger, DuckDuckGo Privacy Essentials, and Brave Browser.
Privacy-focused browsers
Some browsers are designed to reduce tracking, limit trackers, and better protect your personal data.
SafePhone
SafePhone is an Android browser focused on security and safety for everyday users, with features including:
- Blocking malicious websites
- Detecting websites that impersonate brands
- Blocking trackers and ads. See how to block ads on Android
- Warning about dangerous content
- Blocking third-party cookies
SafePhone also analyzes website content to spot signs of scams and phishing. See how SafePhone works and how to browse the web safely.
Firefox
Firefox is known for its built-in privacy features: Enhanced Tracking Protection, blocking many trackers by default, fingerprinting protection (stopping sites from identifying your device by its browser “fingerprint”), cryptomining script blocking, and per-site cookie controls. Firefox also allows deep customization and supports many security extensions.
Brave
Brave focuses on blocking ads and trackers out of the box, with a built-in ad blocker, third-party tracker blocking, tracking cookie blocking, and automatic HTTPS upgrades where possible. Because it blocks so many trackers, Brave often loads pages faster and sends less data to ad companies.
| Browser | Privacy strengths | What sets it apart |
|---|---|---|
| SafePhone | Blocks trackers, ads, third-party cookies | Detects scam and brand-impersonation websites; alerts family members |
| Firefox | Enhanced Tracking Protection, fingerprinting protection | Deep customization, many extensions |
| Brave | Blocks ads, trackers, tracking cookies by default | Automatic HTTPS upgrades, faster page loads |
No browser offers perfect privacy. You should still combine it with safe browsing habits, checking the permissions websites request, avoiding unnecessary logins, using strong passwords, and keeping your browser up to date.
Tracker-blocking extensions
Beyond built-in features, you can install extensions to block more ads, trackers, and tracking systems. They work by blocking ad domains, stopping trackers from sending data back to their servers, detecting tracking scripts, reducing fingerprinting, and limiting unnecessary resource loading.
SafeChrome (SafePhone for Chrome, coming soon)
SafeChrome is an extension that uses blocklist and trusted-list filters, with planned features including blocking malicious websites, detecting brand-impersonation sites, blocking trackers and ads, and warning about dangerous content. Advanced users can create their own filters to block specific harmful content.
uBlock Origin
One of the most popular ad- and tracker-blocking extensions. It uses filter lists to block display ads, pop-up ads, trackers, malicious scripts, and some scam or suspicious domains.
Privacy Badger
Focuses on detecting and blocking trackers that follow you across websites. Unlike extensions that rely only on fixed blocklists, Privacy Badger learns on its own to recognize trackers that appear on many websites, behavior-tracking scripts, and data-collecting domains, then automatically restricts or blocks those connections. It's very useful for reducing ad tracking, limiting user profiling, and preventing cross-site tracking.
Cookie tracking checklist
- ☐ Third-party cookie blocking is on in your main browser
- ☐ Choose “Reject” or “Necessary only” on cookie banners
- ☐ Use incognito mode when borrowing someone else's device
- ☐ Regularly clear cookies for sites you rarely use
- ☐ Use a browser or extension that blocks trackers
- ☐ Log out of public computers; turn on two-factor authentication for important accounts
Conclusion
What are cookies? They're “memory cards” that help websites remember you: useful as first-party cookies, but potentially a tracking tool as third-party cookies. With just a few settings, like blocking third-party cookies, clearing cookies regularly, and using a tracker-blocking browser, you can significantly reduce the personal data collected about you while still browsing normally.
FAQ
What are cookies?
Cookies are small pieces of data that a website stores in your browser to remember your login session, shopping cart, language, and other choices. Cookies are not malware, but they can be used to track your browsing behavior.
What are third-party cookies?
They are cookies created by other services embedded in a page, such as ad networks or trackers. They let those services recognize the same browser across many websites to build an advertising profile.
Should I accept cookies when I visit a website?
You can choose Reject or Necessary cookies only. The website still works, while advertising and tracking cookies are restricted.
Do I lose anything by clearing cookies?
Clearing cookies signs you out of websites and erases saved preferences such as language and shopping carts. In return, old tracking identifiers are wiped too.
Does incognito mode block tracking completely?
No. Incognito mode only stops history and cookies from being kept after you close the window. Your carrier, websites, and trackers can still see part of your activity.