What Is a Cookie
A cookie is a small piece of text that a website asks your browser to store, and hand back on every later visit, so the site can recognize you and remember things between requests — it exists to solve a basic limitation from the how-the-internet-works topic: each HTTP request is independent, so without some kind of memory a website would forget who you are the instant one request ends. When you log in or set a preference, the server sends back a little labeled note — for example `session=abc123` — and your browser, as the web-browser topic described, saves it and automatically attaches it to every future request to that same site. On the next page you load, the site sees that note and knows "this is the same visitor who just logged in," which is exactly how a site keeps you signed in as you click around, how a shopping cart remembers its items, and how a site recalls your language or dark-mode choice. That makes cookies ordinary and genuinely useful; the controversy comes from how they can also be used to track people. It helps to separate two kinds. A first-party cookie is set by the site you are actually visiting and is what makes that site work — logins, carts, preferences. A third-party cookie is set not by the site in your address bar but by another company whose content (often an ad or a tracking script) is embedded in the page; because that same company's code appears on many different sites, its cookie can recognize you across all of them and quietly build a profile of your browsing, which is the privacy concern behind cookie-consent banners and the industry's ongoing move to phase third-party cookies out. Two properties make cookies manageable. They can carry an expiry: a session cookie is deleted when you close the browser, while a persistent cookie survives for a set time so a site can remember you for days or weeks. And they are scoped to a single site: by design, a cookie set by one site is only ever sent back to that same site, so one site cannot directly read another's cookies. This also ties back to the staying-safe-online topic, because a cookie that keeps you logged in is a kind of key — anyone who steals it could impersonate your session — which is why sensitive cookies are protected and only sent over the encrypted HTTPS connection. The practical takeaway is that a cookie is not a program and cannot harm your computer; it is just a small remembered note. First-party cookies are mostly what make the modern web usable, third-party cookies are what raised the tracking concerns, and you stay in control through your browser's settings to view, block, or clear them whenever you choose.