Cambridge O Level Computer Science · Syllabus 2210 · The Internet and its Uses
Cookie
What is Cookie?
A cookie is a small piece of data that a website sends to a web browser, which stores it and returns it to that website on later requests, allowing the site to recognise the same browser; cookies are data and cannot execute as programs.
This definition is part of the The Internet and its Uses chapter in Cambridge O Level Computer Science.
Cookie in context
The internet is the worldwide infrastructure of interconnected networks. The world wide web is the collection of websites and web pages that is accessed using that infrastructure. When you type a URL, the browser separates out the domain name, asks the domain name server (DNS) to turn it into an IP address, sends an HTTP or HTTPS request to the web server at that address, receives HTML and other resources back, and renders the page on your screen. Along the way the browser may store cookies. The same infrastructure carries digital currency transactions, which a blockchain records as time-stamped, hash-linked blocks so that a change to an old record is detectable. And because everything above is reachable from anywhere, Topic 5 finishes with the cyber security threats that exploit it and the layered solutions that reduce them.
A web browser is the application software used to access and display web pages. Its main purpose is to render HTML and display web pages — that is, to interpret the HTML sent back by a web server and turn it into the formatted text, images and multimedia the user sees. Around that central job it also provides an address bar, navigation tools, multiple tabs, bookmarks or favourites, a record of user history, and the storage of cookies.
A cookie is a small piece of data that a website sends to the browser, which the browser stores and then sends back to that same website on later requests. Cookies let a site recognise the same browser again, which is how it can keep a user logged in, remember a shopping cart, save personal details, and store preferences. A session cookie is normally kept only until the browsing session ends; a persistent cookie is stored on the device until its expiry date is reached or the user deletes it. A cookie is data, not a program — it cannot run and it is not a virus — but because it can carry an identifier that follows a user around, it raises real privacy concerns.
Common mistakes with Cookie
- M10 — "Cookies are programs, or viruses, and they infect your computer." Why it is wrong A cookie is a small piece of data stored by the browser and returned to the site that set it. It cannot execute, replicate or damage anything. The genuine concern is privacy: a persistent identifier can be used to build a picture of browsing behaviour. Say instead "Cookies are data, not programs, so they are not malware — but persistent cookies can be used to track a user across visits."
Questions students ask about Cookie
What is the difference between a session cookie and a persistent cookie?
A session cookie has no expiry date set and is normally held only while the browsing session lasts, being deleted when the browser or session closes; it is used for tasks such as keeping a user logged in or holding items in a shopping cart during one visit. A persistent cookie is stored on the device with an expiry date and remains until that date is reached or the user deletes it, so it is returned to the site on future visits, which is how sites remember saved details or preferences.

