Glossary · Web Development

Cookie

KUUK-eenoun

A cookie is a small file a website stores in a user's browser to remember information across pages and visits.

Part of speech
noun
Pronunciation
KUUK-ee
Origin
Borrowed from 'magic cookie,' an older computing term for a small token of data. Web cookies were introduced by Netscape in 1994.

What is Cookie?

A cookie is a small piece of data that a website stores in a visitor's web browser and can read back on later requests, allowing the site to remember information across pages and across visits. Because the web itself is stateless, meaning each request to a server is independent and carries no memory of what came before, cookies provide the mechanism that lets a website recognize a returning visitor, keep them logged in as they move between pages, remember the contents of a shopping cart, or recall their preferences. Without cookies, a site would treat every page view as if it were meeting the visitor for the first time.

The mechanics are simple in principle. When a browser requests a page, the server can include a small instruction telling the browser to store a cookie, which is essentially a named value along with some rules about how long to keep it and which site it belongs to. The browser saves this on the visitor's device, and on every subsequent request to that same site, it automatically sends the cookie back, so the server can read it and act on the information it holds. Cookies come in different forms: session cookies that vanish when the browser closes, and persistent cookies that remain for a set period, as well as first-party cookies set by the site being visited and third-party cookies set by other domains, which have historically been used for tracking across sites.

The name is borrowed from "magic cookie," an older computing term for a small token of data passed between programs. Web cookies were introduced by Netscape in 1994 to solve exactly the memory problem described above, and they quickly became a cornerstone of interactive websites. The playful name stuck even as cookies grew into a serious part of web infrastructure and, later, a focus of privacy debate.

For a business, cookies matter because they enable the features and measurement that modern websites depend on. They keep users logged in, preserve shopping carts through checkout, personalize content, and allow analytics tools to understand how visitors behave, which sessions convert, and which campaigns drive results. Advertising and remarketing have long relied on cookies to recognize users and measure outcomes. In short, much of what makes a site convenient and much of how a business learns from its traffic runs on cookies.

The nuances are increasingly important, because cookies sit at the center of privacy law and changing browser policies. Regulations in many regions require sites to obtain consent before setting certain cookies and to explain what they do, so a business must handle cookies transparently and lawfully or risk penalties and lost trust. At the same time, browsers have moved to restrict third-party cookies, which disrupts cross-site tracking and pushes measurement toward first-party data and other approaches. The common mistakes are setting unnecessary cookies without consent, failing to secure cookies that carry sensitive session information, and building a measurement strategy so dependent on third-party cookies that it collapses as those cookies disappear. Handling cookies carefully, using them where they genuinely add value, securing them properly, and respecting consent, is now part of running a responsible and resilient website.

Why it matters

Cookies underpin essential site functions and measurement, but handling them correctly is now a legal and trust requirement that affects analytics accuracy.