A cookie is a text file containing an identifier that is sent by a web server to a web browser and is stored by the browser. The identifier is then sent back to the server each time the browser (user) requests a page from the server.
Cookies are used by web servers to identify and track users as they navigate different pages on a website and identify users returning to a website.
There mainly two types of cookies: persistent cookies and session cookies. Persistent cookies are stored by the web browser and remain valid until its set expiry date, unless deleted by the user before the expiry date. Session cookies expire at the end of the user session, when the web browser is closed.
Most browsers allow users to change the settings and preferences for cookies.