How Long Can Cookies Last?
Cookies can last as long as their creator wants them to. The duration can be set when cookies are created. While session cookies are destroyed when the current browser window is closed, they can also persist for long after the page is closed. While every cookie has an expiry, this is just the date when the browser should no longer send the cookie to the server. In most cases, this means that after this date the browser will delete the cookie, but it depends on the clean up algorithms in the browser. It also depends on the browser running, as if the browser is not run, then it can’t clean up the cookie.
However, there are also persistent cookies that survive after you close your browser’s window. Persistent cookies can be used by websites to recognize your device in order to create personalized ads and optimize user experience for the next time you visit a website. Persistent cookies also create a convenient and faster website experience and enhances its performance. Such cookies have an expiration date issued to it by the webserver. This type of cookie is saved on your computer so when you close it and start it up again, the cookie is still there. For example, they are vital if you want to save your login details. However, once the expiration date is reached, persistent cookies are destroyed by the owner.