A cookie is a collection of data – typically small – provided by a web page, downloaded by your browser, and stored on your machine. The next time your browser requests a page from that same domain, all cookies that were last provided by that domain are included with the page request.
For example, you visit somerandomservice.com for the first time. When the initial page is downloaded, included with that page might be some data in a cookie, which says “SeenFirstPage=1.” That data – the domain somerandomservice.com and its cookie “SeenFirstPage=1” – is stored by your browser on your machine. The next time you visit any page on somerandomservice.com, your browser includes the “SeenFirstPage=1” cookie with the request. In this example, the site may then elect to perhaps present a different page, knowing you’ve seen the first page.
The actual contents and usage of cookies is not defined, and may be anything as defined by the website that uses them.
In practice, cookies are frequently used to store information that prevents people from needing to log in over and over for every single page on a site that a requires a log in (such as an email service), to maintain the state of a shopping cart when shopping in an online store, and to provide a more seamless experience on feature-rich web sites.