Step-by-step guide

What Browser Cookies Are and How They Work

Published June 2011 · Updated September 2026

Published

Cookies:

Mmmmm!  Cookies.

Think about Grandma’s cookies and that yummy feeling settles in but that other cookie can strike fear in many computer users.  We know our computers have them but what’s a cookie to a computer anyway and why do we have them?  What do they do?  Do they harm computers?  Give away our most private data?  Do we even want these cookies?

The reality is Grandma’s cookies will always be tastier than a computer cookie.  A computer cookie can’t run on your computer or harm it, and many of them do us some good.  But some cookies also track what you do online, so it pays to know what they are.  And just like a plate of the yummy stuff, you can decline most computer cookies when they come your way.

A browser cookie is a small piece of text data, not a program.  When you visit a website, the site sends the cookie to your browser and your browser stores it on your computer.  The next time you visit, your browser sends the cookie back so the site can recognize you.  Cookies do not make pages load faster.  That is the job of a different feature called the browser cache, which stores copies of page files.  A cookie only holds a small amount of information, such as a sign-in token, a language choice or the items in a shopping cart.

Let’s go on an imaginary internet shopping spree to illustrate the point.  Think of your favorite internet store. Let’s say the last time you were there, you bought a pair of shoes (blue, size 7), a dress to match (also blue, size 10), and three cases of bottled water.  You paid for the purchase with a credit card and probably had to establish an account with the merchant before the sale was complete.  You surely had the goods shipped to you at home or somewhere.

The next time you go to that store’s website, cookies can make the visit smoother.  A cookie can keep you signed in and remember what is in your cart.  The store’s own records, kept on its servers and linked to your account, are what hold your order history, your shoe size and your saved addresses.  The cookie simply tells the store which account is yours.

Before completing the purchase, you may be asked to sign in to your account.  If the site set a cookie, you might stay signed in from your last visit.  Without cookies, you’d have to sign in again each time you open the site.

What about your credit card?  Reputable stores do not keep your card number in a cookie.  Card numbers are handled by the store’s payment processor on its servers, and payment security rules forbid storing full card data on your computer.  If a site asks you to re-enter your card each time, that is a safety feature, not a flaw.

Cookies are not programs and cannot change anything on your computer.  They are still worth taking seriously.  A sign-in cookie can be stolen by an attacker, for example through a malicious script on a site, and used to take over your session without your password.  Advertising and analytics companies also set third-party cookies that follow you from site to site to build a profile of your interests.  So cookies are not just between you and the merchant.

Still leery?  Look to the settings menu of your browser.  Each browser puts its cookie preferences in a different location, so search the settings for “cookies” or “site data.”  From there you can see the cookies you’ve accumulated and delete any or all of them.  Of course, you’ll have to sign in again and re-enter some preferences on sites whose cookies you’ve deleted.

You can also set your browser to block third-party cookies, which stops most cross-site tracking, or to ask you each time a cookie wants to be installed (this is a slow process).  You can even block all cookies.  Most sites will still show you their pages, but anything that needs you to sign in or keep a shopping cart will stop working.

Cookies are neither all good nor all bad.  Cookies from the sites you use save time and spare you a lot of repetition.  Third-party tracking cookies are the ones to watch, and blocking them is a sensible choice for most people.  For your own security, sign out of sites on shared computers and keep your browser up to date.

The worst thing about a computer cookie?  It will never taste as comfortably delicious as the ones Grandma makes.