cookie is defined by the communication protocol HTTP as a string of information sent by an HTTP server to an HTTP client, which the client returns to the same HTTP server each time it makes a request under certain conditions.

The cookie is essentially a small text file stored on the user’s device. Existing for more than 20 years, cookies allow website developers to retain user data to facilitate navigation and enable specific functions. Cookies have always been somewhat controversial because they may contain residual personal information that could potentially be exploited by third parties.

It is sent as an HTTP header from the web server to the web browser, which then sends it back unchanged every time the server is accessed. A cookie can be used for authenticationsession management, and to store specific information about the user, such as site preferences or the contents of an online shopping cart.

The term “cookie” is derived from “magic cookie,” a well-known concept in UNIX computing, which inspired the idea and name of web browsing cookies. Several alternatives to cookies exist, each with its own uses, benefits, and drawbacks.

As simple text files, cookies are not executable. They are neither spyware nor viruses, although cookies from certain sites are detected by some antivirus software because they enable user tracking when visiting various sites. Most modern browsers allow users to choose whether to accept or reject cookies and set the duration for cookie storage. However, completely rejecting cookies can make some websites unusable (for example, online shopping carts or sites requiring login credentials).

Source: Wikipedia.