Digital Literacy

Cookies and Local Storage

A website remembers more than its address. It may recall the language you chose, keep you signed in, or retain the contents of a shopping basket. It does this, in part, with small pieces of information stored in your browser: cookies and local storage.

The names suggest a kitchen cupboard. The reality is less domestic, but the basic idea is familiar: a site leaves a note for your browser, and the browser may bring it back on a later visit. Understanding what is written, where it is kept, and who can read it makes the web a little less mysterious—and helps you make more informed choices about convenience and privacy.

At D1: One Idea at a Time, we take everyday technology one useful concept at a time. This one begins with a simple distinction: cookies and local storage both hold information in your browser, but they do not work in quite the same way.

What a browser stores—and why

When your browser opens a website, it requests information from a server. By itself, that exchange does not necessarily give the site a dependable memory of your previous visit. Browsers therefore offer ways for websites to store small amounts of data on a device. On a later visit, the site may use that data to restore a preference or recognize a session.

Some examples are mundane by design: a language choice, a display preference, or the items you placed in a basket. Others concern identity and activity, such as whether you have signed in or which pages you viewed. The technology is not inherently benevolent or sinister. Its meaning depends on what is stored, how it is used, how long it remains, and which parties can access it.

These records are not the same as a complete history of everything you do online. They are pieces of data associated with particular sites or functions. But, combined with other information, they can contribute to a broader picture of browsing activity.

Cookies: brief notes from a website

A cookie is a small text record that a website can ask a browser to save. When the browser later makes a relevant request, it may send the cookie back. This exchange helps a site recognize information from an earlier interaction—for example, that a user has already signed in or selected a particular setting.

Cookies can be temporary or persistent. A session cookie is generally used during a browser session and may be removed when that session ends, though exact behavior can depend on browser settings. A persistent cookie is given an expiration period and can remain available across visits until it expires or is deleted.

Cookies can also carry security-related settings, such as instructions limiting when they are sent or whether scripts running in a page can access them. Those settings can reduce certain risks, but a cookie is not a magical security seal. A site’s overall design and the browser’s protections matter too.

First-party and third-party cookies

A first-party cookie is associated with the site you are visiting. If you visit a newspaper’s website and it stores a preference for text size, that is a typical first-party use.

A third-party cookie is associated with a different party whose content or service appears within the page. Historically, advertising and analytics services have used these cookies to recognize a browser across multiple sites where their tools are present. That cross-site visibility made third-party cookies especially important in debates about tracking and privacy.

The boundary is not always as straightforward as the labels make it sound. Browsers and websites may apply restrictions, partition storage, or block some third-party uses. Policies and technical behavior change over time, so “third-party cookie” does not describe one universal experience across every browser or site.

Local storage: a different kind of note

Local storage is a browser feature that lets a website save information on a device and retrieve it later. A site might use it to remember a display preference or keep part of an application’s state between visits. Unlike cookies, local-storage data is not automatically attached to every request to the website’s server; page scripts generally read it when needed.

That difference matters, but it should not be mistaken for a promise of privacy. A website’s code can still read the information it has stored, and the site may send that information to a server when the page is running. Local storage can also remain on the device until it is removed or the browser clears it under its own rules.

Cookies and local storage are not the only ways websites can retain data. Browsers provide several storage mechanisms, each with its own purpose and behavior. For a reader, the practical lesson is not to memorize every technical category; it is to remember that “stored in my browser” does not necessarily mean “known only to me.”

A short history of remembering the web

The web was built around documents and requests, not personal recollection. In its early, simple form, a page could be sent to a browser and read without the server needing to remember much about the visitor. But as websites became places to shop, bank, publish, and manage accounts, they needed ways to carry context from one request to the next.

Cookies became one practical answer. They helped turn a sequence of separate page requests into something that could feel like a continuing visit: a basket that stayed full, a login that lasted, a setting that did not need to be chosen again. As online advertising and measurement grew, the same general capacity to remember a browser acquired a wider and more controversial role.

This is one of the quiet cultural shifts of digital life. Convenience often depends on memory: the site that knows your language is easier to use than the one that asks every time. Yet memory can also make people wonder what is being recorded and for whose benefit. The tension is not a glitch in the story of the web; it is part of the story.

Convenience, privacy, and the trade-off

Stored data can make a site smoother to use. It may keep you signed in, preserve a preference, or save progress in a form. It can also support analytics, personalization, and advertising. Whether a particular use feels acceptable depends on the information involved, the purpose, your expectations, and the choices the site offers.

Clearing cookies or local storage can remove saved preferences and sign-in information. It may also reset a basket or cause a site to ask you to make choices again. Clearing data does not erase information a website has already received or retained on its own systems, nor does it necessarily remove every kind of browser storage.

Private-browsing modes can limit what remains on the device after a private session, but they do not make a person invisible to every website, network, or service used during that session. For a broader look at permissions and data choices, see Understanding Privacy Settings.

How to review or clear stored data

Browser menus differ, and their labels change between versions, but the route is usually found in settings under a heading such as Privacy, Security, or Site data. You can often review data for one site, clear selected categories, or remove browsing data for a chosen time range.

  1. Open your browser’s settings. Look for privacy, security, cookies, or site-data controls.
  2. Choose the scope. If available, remove data for one site rather than clearing everything at once.
  3. Check what will be removed. Clearing cookies may sign you out; clearing site data may also remove saved preferences or locally stored information.
  4. Review site permissions separately. Storage controls are not the same as permissions for location, camera, or notifications.

If a site stops behaving as expected, removing that site’s stored data and visiting it again may help. You may need to sign in or set preferences once more. For practical steps to protect accounts themselves, read Passwords and Passkeys and Multifactor Authentication.

These are general pointers, not instructions for a particular browser version. Consult your browser’s current help pages for exact menu names and options.

A practical checklist

  • Ask what a site says it is storing and why, especially when a choice is offered.
  • Treat “necessary” as a description to examine, not a guarantee that every detail is obvious.
  • Remember that first-party storage can support useful features, while third-party storage has often enabled cross-site tracking.
  • Use browser controls to review or clear data when it suits you, knowing that this may reset site features.
  • Do not assume that clearing data from your device deletes records already held elsewhere.

The idea to keep

Cookies and local storage are ways for websites to leave information in your browser. Cookies may be sent along with relevant requests; local storage is typically read by code running in the page. Both can make digital life more convenient, and both deserve a little attention.

The useful question is not simply whether a site stores something. It is what it stores, what purpose it serves, how long it stays, and what control you have over it. One small note at a time, the web becomes easier to read.

Theme