Cookies are pieces of data, normally stored in text files, that websites place on visitors' computers to store a range of information, usually specific to that visitor - or rather the device they are using to view the site - like the browser or mobile phone.
They were created to overcome a limitation in web technology. Web pages are 'stateless' - which means that they have no memory, and cannot easily pass information between each other. So cookies provide a kind of memory for web pages.
Cookies allow you to login on one page, then move around to other pages and stay logged in. They allow you to set preferences for the display of a page, and for these to be remembered the next time you return to it.
Cookies can also be used to watch the pages you visit between sites, which allows advertisers to build up a picture of your interests. Then when you land on a site that shows one of their adverts - they can tailor it to those interests. This is known as 'behavioural advertising'.
Cookies are incredibly useful – they allow modern websites to work the way people have come to expect – with every increasing levels of personalisation and rich interactive functionality.