Why are cookies used?Last Updated: October 14, 2019
Cookies are used to carry information from website to website, or between sessions on related websites, without having to burden a server machine with massive amounts of data storage. If there is a large amount of information to store, then a cookie can simply be used as a means to identify a given user so that further related information can be looked up on a server-side database. For example, the first time a user visits a site, they may choose a username which is stored in the cookie, and then provide data such as password, name, address, preferred font size, page layout, etc. This information would all be stored on the database using the username as a key. Subsequently when the site is revisited the server will read the cookie to find the username, and then retrieve all the user’s information from the database without it having to be re-entered.