What is a Cookie?

Cookies are pieces of text that are sent to a user’s web browser. Cookies can help you create shopping carts, user communities, and personalized sites. It’s not recommended that you store sensitive data in a cookie, but you can store a unique identification string that will match a user with data held securely in a database.
Take the shopping example. Suppose you assign an identification variable to a user so that you can track what he does when he visits your site. First, the user logs in, and you send a cookie with variables designed to say, “This is Ruchita, and Ruchita is allowed to be here.”
While Ruchita is surfing around your site, you can say, “Hello, Ruchita!” on each and every page. If Ruchita clicks through your catalog and chooses 14 items to buy, you can keep track of these items and display them all in a bunch when Ruchita goes to the checkout area.
A cookie is a text-only string that gets entered into the memory of your browser. This value of a variable that a website sets. Web cookies, tracking cookies or just cookies, are parcels of text sent by a server to a Web client (usually a browser) and then sent back unchanged by the client each time it accesses that server. HTTP cookies are used for authenticating, session tracking (state maintenance), and maintaining specific information about users, such as site preferences or the contents of their electronic shopping carts. The term “cookie” is derived from “magic cookie,” a well-known concept in UNIX computing which inspired both the idea and the name of HTTP cookies