What is Cookie?
A cookie is a small piece of text file that contains data. The data in the cookie is often a random key or token. The server use a cookie to identify a client. Specific cookie known as HTTP cookie is used to identify a specific user and to keep track of that user’s movements within the site.
Suppose, you have visited a shop for the first time & bought some cloths of your favorite color. The owner has given you a membership card. Now, if you go again, he might not remember your face but he will recognize the card issued by his shop & can find your buying history & can serve you well. Here, the shop is the web server, you are the client and the membership card is the cookie. As the membership card will not be valid for other shops similarly a cookie won’t be valid for a different website.