Cookie
Cookie
A small piece of data saved in your browser when you visit a website
In Simple Terms
A cookie is a small piece of data — like a membership card — that lets a website recognize "oh, this person has been here before." Thanks to cookies, once you log in you can move between pages and stay logged in, and you can browse an online store without losing the items in your cart. It's a key piece of data for identifying you as a user.
Behind the Name
The "cookie" in your web browser is named after the baked treat we all know! In computing, the term traces back to "magic cookie" — a long-standing programmer expression for a small chunk of data passed between programs. Another popular theory draws a parallel to the fortune cookie: just as a tiny slip of paper is tucked inside, a small piece of identifying data is tucked into your browser.
Take a Closer Look!
A cookie is a small piece of data that a website saves to your browser when you visit it.
At its core, communication between your browser and a website is stateless — each request is treated as brand new, with no memory of what came before. Cookies solve this by giving websites a way to recognize you across visits.
Here's how it works: the first time you visit a website, the site sends a small identifying marker to your browser.
Your browser saves it and sends it back to the site on every subsequent visit.
This lets the website say "oh, it's you again" and pick up right where you left off.
The most common uses are keeping you logged in on member sites and preserving the contents of your shopping cart.
Cookies are also widely used in advertising — by using a cookie as a marker to recognize visitors from the same browser, sites can show ads tailored to your browsing habits.
Some people are uncomfortable with this kind of tracking, so many websites now give you the option to accept or decline cookies.