English edition
Culturera
Internet

What browser cookies actually do (and why every site asks you to accept them)

Invented in 1994 for a shopping cart, tiny plain-text browser cookies now power logins, track ads across sites, and trigger pop-ups worldwide.

A bright desk with a laptop showing abstract pastel toggle switches and puzzle shapes, beside a small plate with a bitten chocolate chip cookie and a mug of tea in crisp morning light.
Illustration: Culturera

Every visit to a modern website begins with the same tiny ambush: a pop-up asking you to accept cookies before you can read a recipe, check a train schedule, or open a news story. Most people tap the brightest button just to clear the screen, without really knowing what they agreed to—or what landed inside their browser a fraction of a second later.

This guide explains where cookies came from, what a cookie actually is, how they power logins and shopping carts, how ad networks turned them into cross-site trackers, why privacy laws triggered global banners, and what is replacing third-party cookies today.

A tiny note written in plain text

Despite its ominous reputation, a browser cookie is not a program, spyware, or a hidden virus. It cannot read files on your hard drive, open your webcam, or run code on your computer.

A cookie is simply a short plain-text key-value pair—such as session_id=8f3a91c2 or currency=USD—that a web server asks your browser to hold onto. Most cookies take up only a few dozen bytes, and standards cap each cookie at roughly 4 kilobytes of text, while limiting how many cookies any single domain can store.

Browsers need these notes because HTTP, the protocol that delivers web pages, is stateless by design. Every click looks to the server as though a stranger knocked on its door for the first time. Without memory, an online store would forget who you are the instant you moved from a product page to checkout.

Cookies fix that amnesia cleanly. A server replies with a Set-Cookie header containing a text value and expiration rules. On every return request to that domain, your browser automatically sends back a matching Cookie header, letting the server recognize your session or remember your dark-mode choice.

How a shopping cart problem invented the cookie in 1994

The cookie was not built for advertising. It was invented in 1994 at Netscape Communications to solve a practical e-commerce problem.

A 23-year-old Netscape engineer named Lou Montulli was helping the telecom company MCI build an early online store. MCI needed a virtual shopping cart that remembered items across page loads, without forcing MCI's servers to maintain millions of unfinished carts for visitors who might never check out.

Montulli's answer was to store that cart state on the customer's own computer. Instead of keeping an open database row for every browser on the web, the server handed the visitor a compact text token, and the browser returned it on the next click.

For the name, Montulli borrowed magic cookie from Unix and C programming jargon, where engineers already called a small opaque session token a magic cookie—like a coat-check ticket that tells the clerk which coat is yours. Montulli and colleague John Giannandrea filed a patent in 1995, and RFC 2109 standardized HTTP cookies in 1997, back when almost every cookie stayed strictly between you and one site.

Session cookies, persistent cookies, and security rules

When a server creates a cookie, it attaches attributes telling your browser when it expires, where it can travel, and whether scripts may read it.

1. Session cookies: These have no expiration date and live in memory while your visit lasts. Closing the browser deletes them, unless tab-restore keeps the session alive. Sites use them for active logins and temporary carts.

2. Persistent cookies: These carry an Expires date or Max-Age timer in seconds, so your browser saves them to disk for days or months—powering "remember me" logins and saved language settings.

3. HttpOnly: This flag hides the cookie from JavaScript on the page, blocking malicious cross-site scripts from stealing login tokens.

4. Secure: This flag tells your browser to send the cookie only over encrypted HTTPS connections, never over open HTTP on public Wi-Fi.

5. SameSite: Using Strict, Lax, or None, this rule controls whether cookies ride along on cross-site links or forms. Modern browsers now default to Lax when a site omits it, blocking classic request-forgery attacks and curbing casual tracking.

First-party vs. third-party cookies

Understanding the cookie debate starts with who sets the note.

When you sign in to daily-example.com or save a weather city, the site stores a first-party cookie under daily-example.com. Only that domain can read it back, keeping your account signed in and your preferences intact.

Modern web pages, however, assemble pieces from dozens of outside servers: embedded videos, social buttons, analytics scripts, ad exchanges, and invisible one-by-one tracking pixels. When your browser fetches a script from adnetwork.example, that external server can reply with its own Set-Cookie header—creating a third-party cookie under a domain you never typed into the address bar.

Alone, one third-party cookie reveals little. Scale turns it into tracking. Because the same ad network embeds its code across thousands of unrelated blogs, stores, and news sites, your browser sends the same adnetwork.example ID back on every visit. By reading the page address on each request, the broker stitches together a cross-site profile—which is why hiking boots you browsed on Tuesday follow you into banner ads on Thursday.

Why every website asks you to accept cookies

For fifteen years, cookies operated mostly out of sight. Europe changed that.

In 2009, the European Union amended its ePrivacy Directive—nicknamed the Cookie Directive—requiring informed consent before storing or reading non-essential data on a user's device. Only cookies strictly necessary for a service the user asked for, such as a shopping cart or secure login, skipped permission. Analytics and targeted ads required a clear yes first.

Early compliance was patchy, with vague banners claiming continued browsing counted as consent. Then May 2018 brought the General Data Protection Regulation (GDPR), which defined valid consent as freely given, specific, informed, and unambiguous—banning pre-ticked boxes and implied permission, and raising potential fines to 20 million euros or 4 percent of global annual turnover.

A cookie banner is rarely asking whether a site can remember your cart. It is asking whether dozens of ad intermediaries can follow you across the web.

Because global publishers serve international audiences, maintaining separate versions for Europe and everyone else proved messy. Ad-tech groups built shared consent frameworks that pass your preference string down the ad-auction chain, and pop-up banners soon became standard worldwide—from Berlin to New York.

Consent dark patterns and why "Reject all" is hidden

If cookie prompts feel exhausting by design, they often are. Many publishers use consent dark patterns to push tired readers toward saying yes.

The familiar trick puts a bright Accept all button right under your thumb beside a faint grey Manage preferences link. Opening that menu reveals dozens of partner toggles and a second tab marked Legitimate interest, a GDPR legal basis some vendors stretch unless you object to each company individually.

European data watchdogs—such as France's CNIL, which fined major tech platforms over skewed prompts—eventually ruled that refusing cookies must be as easy as accepting them. One click to accept requires one click on the first screen to refuse. That enforcement pushed many big publishers to display Reject all upfront, though manipulative layouts still linger on smaller sites.

What actually changes when you click Reject all

Many readers hesitate to click Reject all, worried the site will break or empty their cart. Saying no changes far less than banners imply.

When you decline non-essential cookies, a site can still set strictly necessary first-party cookies. Your login stays active, security tokens protect forms, your shopping cart survives, and the site stores a small preference cookie remembering that you opted out so it stops asking on the next page.

What stops is background tracking. Third-party ad tags quit reading cross-site IDs, retargeting pixels stay silent, social embeds wait until you click, and marketing analytics either switch off or drop to anonymous aggregate counts. You still see ads on ad-supported sites, just contextual ads matched to the article in front of you—running shoes beside a marathon guide—rather than ads chasing your browsing history.

Beyond cookies: local storage and browser fingerprinting

Blocking third-party cookies does not stop every form of tracking.

Modern browsers also provide Web Storage—localStorage and sessionStorage—plus IndexedDB. Unlike cookies, which ride inside HTTP headers on every request, Web Storage keeps megabytes locally for web apps, offline drafts, and player settings. European regulators treat non-essential ad IDs stored there the exact same way as cookies, because ePrivacy rules cover any device storage regardless of format.

A stealthier technique stores nothing at all: browser fingerprinting. A script inspects dozens of tiny system clues your browser exposes when loading a page—screen resolution, operating system, time zone, language, fonts, CPU cores, and graphics-card rendering quirks. Combined, they often form a signature distinctive enough to recognize your device across websites even after you clear cookies or open a private window.

How browsers went to war over third-party cookies

Over the past decade, browser makers split sharply over third-party cookies.

Apple moved first: Safari launched Intelligent Tracking Prevention in 2017 and blocked third-party cookies by default in 2020. Mozilla Firefox followed with Enhanced Tracking Protection and Total Cookie Protection, confining each site's cookies to a separate jar so ad scripts cannot link visits across domains.

Google Chrome, with the largest global market share and an ad-funded parent company, moved much more slowly. In 2020 Google announced a two-year plan to phase out third-party cookies under its Privacy Sandbox initiative. After repeated delays and scrutiny from publishers and antitrust regulators such as the UK's CMA, Google shifted course in 2024 and 2025—dropping a mandatory cut-off in favor of user-managed browser controls, leaving third-party cookies active for most Chrome users unless they opt out.

Practical habits that actually protect your privacy

You do not need to break websites or retype passwords constantly to curb tracking.

6. Use a browser with cookie isolation: Firefox with Enhanced Tracking Protection or Safari blocks cross-site cookie tracking automatically without breaking daily logins.

7. Click Reject all on the first screen: Choose Reject all or Essential only whenever available, and watch out for buried Legitimate interest toggles.

8. Separate sensitive browsing with profiles: Keep banking, work, and health portals in a dedicated browser profile or private window away from casual shopping.

9. Know the limits of Private Browsing: Closing an Incognito window deletes cookies and history from your computer, hiding activity from shared-device users—but it does not hide your IP address or traffic from websites, employers, or your internet provider.

10. Skip aggressive cookie-wiping add-ons: Deleting every cookie on tab close signs you out repeatedly and erases the preference cookies that remember your rejections, bringing banners back on every visit.

A small piece of text that shaped the modern web

In 1994, a 4-kilobyte plain-text note solved a clean engineering problem: helping a stateless web remember a shopping cart. Thirty years later, that same simple mechanism supports bank logins, global ad auctions, and the consent banners we swat away every day.

Understanding what cookies actually do takes the mystery out of those boxes. A tiny text label inside your browser is harmless on its own—and the real choice is never about the cookie, but about who gets to read it.

Internet