What Are Browser Cookies? How They Work and When to Accept or Reject Them

Every website asks you to accept cookies, but what are they? Learn how cookies keep you logged in, how third-party tracking works, and how to manage cookies in your browser.

Information current as of November 2026 · How we research · Report an error

Freshly baked chocolate chip cookies on a cooling rack
Photo by Stanley Kustamin on Unsplash

“We use cookies to improve your experience.” You’ve probably clicked through that banner thousands of times. Cookies are a basic building block of the web: some are essential, some are convenient, and some are used to track you across websites. Knowing the difference helps you make better choices.

A cookie is a small piece of text that a website asks your browser to store. The next time your browser contacts that website, it sends the cookie back.

Why is that needed? The web’s basic protocol, HTTP, has no memory: each request is independent. Without cookies, a website wouldn’t know that the person adding an item to a cart is the same person who just logged in. A cookie acts like a ticket that says, “this is the same visitor as before.”

A cookie usually contains a name, a value (often a random identifier), the website it belongs to, and an expiry date.

What cookies are used for

Essential cookies

These keep websites working:

  • Keeping you logged in as you move between pages.
  • Remembering what’s in your shopping cart.
  • Security features, such as protection against fraudulent form submissions.

Rejecting non-essential cookies on a consent banner doesn’t block these.

Preference cookies

Remember choices such as language, region, dark mode or video quality.

Analytics cookies

Help website owners understand how visitors use the site: which pages are popular, where people leave, how long pages take to load. Many analytics tools collect data in aggregated form.

Advertising cookies

Used to show ads, limit how often you see the same ad, measure whether ads work and, in some cases, personalize ads based on your interests.

First-party vs third-party cookies

This is the most important distinction for privacy.

  • First-party cookies are set by the website you’re visiting. If you’re on example.com, a cookie from example.com is first-party.
  • Third-party cookies are set by a different domain whose content is embedded on the page, such as an ad network, social media button or analytics service.

Because the same third-party service can be embedded on thousands of websites, its cookie can recognize your browser on all of them. That’s how cross-site tracking has traditionally worked.

Browsers have been restricting this. Safari and Firefox block most third-party tracking cookies by default, and other browsers offer settings or controls to limit them.

Session vs persistent cookies

  • Session cookies are deleted when you close the browser.
  • Persistent cookies remain until their expiry date or until you delete them. That’s why you stay logged in to some sites for weeks.

Privacy laws, including the EU’s GDPR and ePrivacy rules and similar laws elsewhere, require websites to ask for consent before storing non-essential cookies or similar identifiers on your device. That’s why many sites show a banner with options like Accept all, Reject all or Manage preferences.

Should you accept or reject cookies?

There’s no single right answer, but here’s a practical approach:

  • Accept essential cookies: they’re required for the site to work.
  • Reject non-essential cookies on sites you don’t trust or don’t plan to use often. You’ll usually still see ads, just less personalized ones.
  • Accept on sites you use regularly if you value convenience features and want to support the site.

Rejecting cookies doesn’t usually stop the website from working. You may simply need to log in again or reset preferences more often.

How to manage cookies in your browser

Google Chrome

Settings → Privacy and security → Third-party cookies to control third-party cookies, and Delete browsing data to remove existing cookies.

Safari (Mac and iPhone)

  • Mac: Safari → Settings → Privacy shows Prevent cross-site tracking and Manage Website Data.
  • iPhone: Settings → Apps → Safari (or Settings → Safari on older iOS) has Prevent Cross-Site Tracking and Clear History and Website Data.

Microsoft Edge

Settings → Privacy, search, and services offers Tracking prevention levels and options to clear browsing data.

Firefox

Settings → Privacy & Security offers Enhanced Tracking Protection in Standard or Strict modes and a Cookies and Site Data section.

Tip: clearing all cookies signs you out of almost every website. If you only want to remove trackers, block third-party cookies instead of deleting everything.

Cookies aren’t the only tracking method

Websites and advertisers can also use techniques such as browser fingerprinting (identifying your browser from its unique combination of settings), tracking links, and data from accounts you’re logged into. Browsers with strong tracking protection and privacy-focused settings help reduce these too.

Common myths

  • “Cookies are viruses.” No. They’re plain text and can’t run code on your computer.
  • “Cookies can read my files.” No. A website can only read the cookies it set itself.
  • “Rejecting cookies makes me invisible.” Not entirely; it reduces tracking but doesn’t make you anonymous.

The bottom line

Cookies are small text files that let websites remember you. First-party cookies keep sites working and convenient; third-party cookies have mostly been used for cross-site tracking. Keep essential cookies, limit third-party ones in your browser settings, and choose consciously on consent banners.

cookiesprivacybrowserstracking