What is a cookie?

A cookie is a small piece of text that a website asks your browser to save, so the site can remember you between page loads. It is how a site keeps you logged in, holds your shopping cart and remembers your settings. It is not a program and cannot run on your computer.

Should I accept cookies?

How cookies work: the round trip

Step through what happens when an online shop remembers your cart. The server creates the cookie, your browser stores it and sends it back on every request to that site.

Step 1 of 4: You open a website

Your browser asks the site's server for a page. On a first visit it has no cookie for this site, so the request carries nothing that says who you are.

GET /cart HTTP/1.1
Host: shop.example

Try it: let this page remember you

Save a real demo cookie for nitroclaw.com, then reload. It holds only a visit count and stays in your browser. Nothing is sent anywhere else.

No demo cookie yet

Save one, then reload the page to see the site remember you.

Cookies nitroclaw.com can read in your browser right now

Checking…

Only this site's cookies show here: a page can never read another site's cookies. Login cookies marked HttpOnly are hidden from page scripts too, which is why they are safer.

Session vs persistent cookies

The difference is how long the browser keeps the cookie. Chrome caps any cookie at 400 days, even if a site asks for longer.

FeatureSession cookiePersistent cookie
How long it lastsUntil you close the browserUntil its expiry date, from minutes to about 13 months
How the server sets itNo Expires or Max-AgeExpires=date or Max-Age=seconds
Typical usesShopping carts, one-time sign-ins, form stepsRemember me, language and theme, analytics IDs
Survives a restart?No (unless the browser restores your tabs)Yes

First-party vs third-party cookies

The difference is who sets the cookie. First-party cookies come from the site you are on. Third-party cookies come from other domains embedded in the page, which is how ad networks track you across websites.

FeatureFirst-partyThird-party
Who sets itThe site in your address barAnother domain loaded inside the page, such as an ad network
What it can doLogins, carts, preferences, the site's own analyticsFollow you across many sites to build an ad profile
ChromeAllowedAllowed by default; you can block them in settings
Safari and FirefoxAllowedBlocked or kept separate per site by default

Should I accept cookies?

Cookie banners group cookies by purpose. Here is what each choice means for you.

Strictly necessary

Keeps you logged in, holds your cart and remembers your cookie choice.

If you reject: You usually cannot turn these off. The site would break without them.

Always on, and safe to keep.

Preferences

Remembers your language, region, theme or video volume.

If you reject: The site works but forgets your settings each visit.

Accept if you visit the site often.

Analytics

Counts visits and clicks so the site can see which pages work.

If you reject: Nothing changes for you. The site just gets less data.

Your call. Rejecting costs you nothing.

Marketing

Lets ad networks recognize you on other sites and show targeted ads.

If you reject: You still see ads, but they are less personalized.

Reject if you care about tracking.

How to see and clear cookies

To see one site's cookies, click the icon to the left of the address bar and open Cookies and site data. To clear them all:

  1. Open the clear data screen. Press Ctrl+Shift+Delete on Windows or Cmd+Shift+Delete on a Mac in Chrome, Edge or Firefox, or use the menu path for your browser.
  2. Pick a time range. Choose All time to remove every cookie, or a shorter range if you only want to undo recent visits.
  3. Tick only cookies. Select Cookies and other site data. Leave saved passwords and browsing history unticked unless you want them gone too.
  4. Clear and sign back in. Confirm. You will be signed out of most sites, so have your passwords ready.
Chrome
Settings → Privacy and security → Delete browsing data → tick Cookies and other site data → Delete data.
Safari (Mac)
Safari → Settings → Privacy → Manage Website Data → Remove All. On iPhone: Settings → Apps → Safari → Clear History and Website Data.
Edge
Settings → Privacy, search, and services → Delete browsing data → Choose what to clear → tick Cookies and other site data → Clear now.
Firefox
Settings → Privacy & Security → Cookies and Site Data → Clear Data → tick Cookies and Site Data → Clear.

Cookie quiz: test yourself

  1. 1. What is a browser cookie?
  2. 2. Which header does a server use to create a cookie?
  3. 3. A cookie with no expiry date is a…
  4. 4. You are on news.example and an ad from ads.example sets a cookie. That cookie is…
  5. 5. What happens if you reject all optional cookies?

0 of 5 answered

Frequently asked questions

What is a cookie on a website?

A cookie is a small piece of text that a website asks your browser to save. Your browser sends it back on each visit, so the site can remember things like your login, your cart or your language.

Are cookies dangerous?

No. Cookies are plain text and cannot run code, carry viruses or read your files. The real risks are privacy, when third-party cookies track you across sites, and theft of a login cookie on an unsafe network or by malware.

Should I accept cookies?

Accepting necessary cookies is fine and usually required. Accept preference cookies on sites you use often. Reject marketing cookies if you do not want ads to follow you, and analytics cookies if you prefer. The site will still work.

What happens if I reject cookies?

Rejecting optional cookies changes little: the site works, ads are less personal and some settings may not be remembered. Blocking all cookies in your browser, including necessary ones, will stop you from staying logged in or keeping a cart.

Should I clear my cookies?

Clear cookies when a site misbehaves, after using a shared computer, or to reset tracking. You do not need to do it routinely, and it signs you out of most sites.

Are third-party cookies going away?

Not everywhere. Safari and Firefox already block or isolate them by default, but Google dropped its plan to remove them from Chrome in 2025, so Chrome still allows them unless you block them in settings.