Cookies are text files with small pieces of data — like a username and password — that are used to identify your computer as you use a computer network.
With the browser as the bridge, Cookies are stored in RAM while the browser is running (called Session Cookies). Once the user logs out of the site or server, Cookies can be stored on the user's local hard disk (called Persistent Cookies).
How do Cookies generally work?
Data stored in a cookie is created by the server upon your connection. This data is labeled with an ID unique to you and your computer.
When the cookie is exchanged between your computer and the network server, the server reads the ID and knows what information to specifically serve to you.
What are Cookies used for?
Session management. For example, cookies let websites recognize users and recall their individual login information and preferences, such as sports news versus politics.
Personalization. Customized advertising is the main way cookies are used to personalize your sessions. You may view certain items or parts of a site, and cookies use this data to help build targeted ads that you might enjoy.
Tracking. Shopping sites use cookies to track items users previously viewed, allowing the sites to suggest other goods they might like and keep items in shopping carts while they continue shopping.