The Cookie Gave the Stateless Web a Memory

The Cookie Gave the Stateless Web a Memory

Lou Montulli invented the HTTP cookie at Netscape in 1994 to give a stateless protocol memory — first for a shopping cart. How it works and why tracking concerns were original.

The HTTP cookie was invented by Lou Montulli at Netscape in 1994 to solve a basic problem: the web's protocol had no memory, so a server could not tell one visit from the next. The first use case was an online shopping cart. A cookie works by having the server ask the browser to store a small token and send it back on later requests, which is what makes logins, sessions, and carts possible. Privacy was a design question from the start — Montulli has written that he rejected a unique per-browser identifier because it could be used to track a user at every website — but the third-party route to cross-site tracking was, in his words, a problem he missed during the design phase, and the group drafting the first cookie standard flagged it in February 1996. This piece explains the problem, the mechanism, and why the cookie was dual-use from birth.

The problem: a web with no memory

The web's transfer protocol, HTTP, was designed to be stateless. Each request a browser makes stands entirely on its own: the server answers it and forgets it. There is no built-in sense in which the server knows that the person asking for this page is the same person who asked for a different page a moment ago. For serving static documents, that simplicity is a virtue — it keeps servers fast and uncomplicated.

But statelessness makes whole categories of useful behavior impossible. If the server cannot recognize a returning visitor, there can be no staying logged in, no shopping cart that remembers what you added, no session that carries context from one page to the next. Every interaction starts from zero. As the web moved beyond static documents toward things people wanted to do, that lack of memory became a hard limit. Something had to let a server connect a series of requests to the same browser, without changing the underlying protocol's stateless nature. That something is the cookie, and naming the problem first matters because the cookie is best understood as the minimal fix for it.

1994: Lou Montulli's cookie

The fix came from Lou Montulli, an engineer at Netscape, who introduced the cookie in 1994 while the company was building its browser. The motivating use case was concrete and commercial: an online store needed a shopping cart, a way to remember what a visitor had put in it as they moved from page to page. Without state, the cart emptied itself on every click. The cookie let the cart persist.

The name was borrowed, not invented. In computing, the term "magic cookie" already referred to an opaque identifier passed back and forth between different pieces of software. Montulli adapted that existing idea to the web, and the shortened "cookie" stuck. That borrowing is a small but telling detail: the cookie was not an exotic new concept so much as an old systems-programming trick applied to a new medium. A modest, well-understood mechanism solved a problem the web could not otherwise handle.

How a cookie actually works

The mechanism is worth describing plainly, because it explains both the usefulness and the controversy. When your browser requests a page, the server can include in its response an instruction that amounts to "please store this small piece of data." The browser saves that token. On later requests to the same site, the browser automatically sends the token back. The server reads it and now knows this is the same browser it gave the token to earlier.

That round trip — server hands out a token, browser returns it on subsequent visits — is the entire basis of web state. A login works because the server recognizes the returning token and treats you as the authenticated user. A shopping cart works because the token ties your additions together across pages. A session is just a series of requests linked by a returned token. The cookie does not make the protocol stateful; it layers a thin memory on top of a stateless protocol by asking the client to carry a marker back and forth. The simplicity is the point, and it is also where the privacy questions begin.

Privacy was a question from the start

The same property that makes a cookie useful makes it a tracking tool. A token that persists and is sent back on every visit is, by definition, a way to recognize you over time. For a single site, that recognition is what you want — it is how the site remembers you are logged in. But the recognition does not have to be limited to the site you are visiting.

The crucial wrinkle is the third-party cookie. A page you visit can include content — such as an ad or an image — loaded from a different domain, and that other domain can set and read its own cookie. If the same third party appears on many different sites and the browser lets it use the same cookie on all of them, it can recognize that browser across those sites, building a picture of where you go. Browsers now differ here: as of Nov 2026, MDN's guide to third-party cookies reports that Firefox (with Enhanced Tracking Protection, on by default) gives third-party cookies a separate cookie jar per site, Safari restricts them by default through its tracking prevention, Edge blocks trackers from unvisited sites and known harmful trackers by default, and Chrome does not block them by default except in Incognito mode or when a user turns blocking on. This cross-site tracking capability was flagged early: in February 1996, before cookies became a public controversy, the group drafting the first cookie standard identified third-party cookies as a privacy threat. The people working on that standard could see that a mechanism for remembering a session could also be a mechanism for following someone around the web. The dual-use nature followed from the mechanism itself: the same returned token that keeps a shopping cart together also lets a site recognize a returning browser. Presenting cookies as simply good or simply sinister misreads them. They were both from the beginning.

YearMilestoneWhat it established
Early 1990sStateless HTTPThe memory problem cookies would solve
1994Montulli's cookie at NetscapeA token-based way to add state, built for a shopping cart
1996–1997Cookies become public knowledgeAn FTC privacy workshop and press coverage turn a quiet mechanism into a controversy
2000s onwardTracking and regulation debatesCross-site tracking becomes a focus of privacy rules and pushback

The table traces the arc from a quiet engineering fix to a public argument that is still running.

From a quiet mechanism to a public debate

For its first couple of years, the cookie was largely invisible to the people it affected — a behind-the-scenes mechanism that browsers handled automatically. That changed in 1996 and 1997, when a U.S. Federal Trade Commission workshop on consumer privacy in June 1996 and press coverage around RFC 2109 (February 1997), the first standards-track cookie specification, brought cookies to wider public attention, and with them the fact that websites were storing identifiers on users' machines. The reaction made cookies controversial and put the tracking question into the open, where it has stayed.

What followed was decades of attempts to manage the tension the design created. Standards efforts tried to formalize how cookies should behave, including how third-party cookies should be treated; browsers added controls to let people see and block them; and eventually privacy regulation took up the question of consent. In the EU, for example, the ePrivacy Directive as amended in 2009 requires Member States to ensure that storing information, or gaining access to information already stored, in a subscriber's or user's terminal equipment is allowed only if that subscriber or user has given consent after receiving clear and comprehensive information, in accordance with Directive 95/46/EC, including about the purposes of the processing. This does not prevent any technical storage or access for the sole purpose of transmitting a communication over an electronic communications network, or as strictly necessary for the provider of an information society service explicitly requested by the subscriber or user to provide that service. Newer tracking technologies also appeared, some building on cookies and some reaching beyond them, but those are descendants of the original mechanism rather than the mechanism itself. The cookie was the first way the web learned to remember, and the argument it started — between the convenience of being recognized and the cost of being tracked — was present at its creation. A token built for a shopping cart in 1994 turned out to carry, from its first day, the whole tension between memory and surveillance that the web has wrestled with ever since.

Project Inquiry