Cookies are small files websites save in your browser to remember settings, keep you signed in, and hold items in a shopping cart as you browse. Learn how they differ from cache and browser history—and why these tiny bits of data can make a familiar site feel easier to use.

Multiple Choice

What are small files attached to your computer to help interact with websites?

Cookies are small data files that websites store on your computer to remember information about you and how you interact with the site. They let a site recognize you on return, keep you logged in across pages, remember your preferences (like language or layout), and even preserve items in a shopping cart as you move around. This makes browsing feel smoother and more personal because the site can tailor what you see based on prior visits. Cache, by contrast, stores copies of website resources such as images and scripts to speed up loading times. Browser history is simply a record of pages you’ve visited. Adware is unwanted software that displays ads.

Website Cookies: The Small Files That Make Browsing Feel Personal

You visit a shopping site, add a pair of shoes to your cart, then click to another page. The shoes are still there. You return to a news site and find it remembers your preferred language. Those small conveniences often rely on website cookies: tiny data files that a site asks your browser to store on your computer or phone.

Cookies help websites remember details between one page and the next, or from one visit to another. They can keep a session running, save preferences, and help a site understand how people move through its pages. They aren’t programs, and they don’t work like miniature spies rummaging through your files. Still, they can hold information that matters, so it’s worth knowing what they do and how to manage them.

What is a cookie, exactly?

A cookie is a small piece of text data created by a website and stored by your web browser. When you visit that site again—or move to another page within it—the browser may send the cookie back. The site can then use the information to recognize a session, recall a setting, or connect your activity to an earlier visit.

Think of it like a coat-check ticket. The ticket doesn’t contain your coat, but it helps the attendant find the right one. A cookie doesn’t contain a whole website or a complete record of your life online. It gives the site a small reference it can use to provide continuity.

A cookie might store a session identifier, a language choice, or a signal that you’ve accepted a privacy notice. Some cookies contain preferences; others help a site count visits or measure which pages get attention. The details vary from site to site.

Cookies are usually linked to a particular website, and browsers apply rules about when they can be read or sent. A cookie from one site generally isn’t available for every other site you visit. That boundary is important—but, as we’ll see, some cookies involve outside companies too.

Why websites use them

Web pages don’t always remember what happened a moment ago. Without cookies or similar tools, a site could treat every click as a brand-new interaction. That would make some everyday tasks clumsy.

For instance, a shopping cart may use a cookie to keep track of items as you browse. A banking site may use one to maintain a secure session while you move between account pages. A news site might remember whether you prefer larger text. And a streaming service could use stored information to keep your language or display settings in place.

These small files can also help websites measure how they work. A site owner might learn that visitors often leave after a confusing sign-up page, or that a certain page takes too long to load. That information can guide changes to the site. It’s a bit like looking at traffic patterns in a shop: the data may show where people pause, but it doesn’t automatically explain what each person is thinking.

Session cookies and persistent cookies

Not all cookies last for the same length of time.

Session cookies usually remain active only while the browser is open. They help a site keep track of a visit as you move from page to page. When you close the browser, these cookies are generally removed.

Persistent cookies stay in the browser for a set period, or until you delete them. They can help a website remember you when you return later. A saved language preference is a simple example. So is a “keep me signed in” feature, though that feature may also rely on other security measures.

The names sound technical, but the difference is straightforward: session cookies are temporary, while persistent cookies can stick around. A website may use both, depending on what it needs to remember.

First-party and third-party cookies

Another useful distinction is who sets the cookie.

A first-party cookie comes from the website you’re visiting. If you’re on a bookstore’s site and it remembers your cart, that’s typically first-party activity.

A third-party cookie is set by a different organization whose content or tools appear on the page. For example, an advertising or analytics company may provide material that loads as part of a website. In some cases, its cookie can be used to recognize a browser across more than one site.

This has made third-party cookies a major privacy topic. When the same advertising company appears on many websites, it may be able to build a broader picture of browsing behavior. Browser makers and regulators have responded in different ways, and rules and features keep changing. So the exact experience depends on the browser, its settings, and the services a site uses.

Cookies aren’t the same as cache or history

The terms can sound interchangeable, but they refer to different things.

Your browser’s cache stores copies of website resources—such as images, stylesheets, or scripts—so pages may load faster the next time. It’s like keeping a few commonly used tools within easy reach. Cache data can take up space, but it generally helps with speed rather than remembering your personal settings.

Browser history is a list of pages you’ve visited. It helps you return to a page later, but it isn’t the same as a cookie. Clearing history removes that record; it doesn’t always remove cookies unless you select that setting too.

And adware is different again. It’s unwanted software that displays advertisements, often in disruptive ways. Cookies are data files used by websites; they aren’t software that runs on their own. A cookie can support advertising, but that doesn’t make the cookie itself adware.

Are cookies dangerous?

Cookies are usually small and limited. They can’t, by themselves, install software or rummage through your computer’s documents. A cookie mainly carries data between your browser and a site that’s allowed to use it.

The bigger concern is often privacy. A cookie may help a website connect visits over time, and tracking cookies can contribute to profiles used for advertising or measurement. If a cookie is tied to an account, activity may be associated with information you’ve shared directly, such as an email address. That doesn’t mean every cookie is harmful; it does mean the purpose and setting matter.

Security matters too. A poorly designed site could handle session cookies badly, which may put accounts at risk. Reputable websites use safeguards, and browsers offer protections, but no single tool makes every online interaction completely private. Good account security—such as strong, unique passwords and two-step verification—still counts.

Managing cookies without making browsing a chore

Most browsers let you view, remove, or restrict cookies. In Chrome, Firefox, Safari, and Edge, these controls are generally found in the privacy or site settings. The names and locations may shift as software updates, but the basic choices are familiar: block some cookies, clear stored data, or remove cookies for one particular site.

Clearing all cookies can sign you out of websites and erase saved preferences. That may be exactly what you want on a shared computer, but it can also mean setting things up again. A more targeted approach is to remove data for a specific site when it behaves oddly or when you no longer want it to remember you.

Private browsing windows usually limit what gets saved on the device after the window closes. They don’t make a person invisible to websites, internet providers, or workplace networks. It’s a handy feature for a temporary session, not a cloak.

Cookie notices can help explain how a site uses stored data. Their wording varies, and the settings may be tucked behind several clicks. Still, it’s worth checking the choices when a site gives them—especially if you’d rather limit advertising or analytics tracking.

Small files, meaningful choices

Cookies make many familiar web features work smoothly. They can keep a cart intact, save a preference, and spare you from repeating the same steps on every visit. At the same time, some cookies support tracking that raises reasonable privacy questions.

A useful rule of thumb is simple: cookies are data, not little apps. Some are essential to a site’s basic functions; others help measure activity or tailor advertising. Knowing the difference makes browser settings less mysterious—and lets you choose how much you want a website to remember.