Cookies are small pieces of data stored in your browser by a website.

They help the site “remember” information about you between visits.


What Cookies Do

  1. Remember logins → You log in once, and next time you visit, you’re still logged in.
  2. Save preferences → Theme, language, or shopping cart items.
  3. Track usage → Analytics and targeted ads.

How Cookies Work

  1. First Visit → You visit a site, the server sends a Set-Cookie header in the HTTP response.
  2. Storage → Your browser saves the cookie locally.
  3. Automatic Sending → On every request to that same domain (API calls, page loads, images, etc.), the browser automatically includes the cookie in the Cookie header — you don’t have to add it manually.

Types of Cookies

Type Purpose Example
Session cookies Temporary, deleted when browser closes Login until you close the tab
Persistent cookies Stay until expiry date “Remember me” login
First-party cookies Created by the site you visit Theme preference
Third-party cookies Created by another domain (ads, trackers) Cross-site tracking

Security & Privacy Notes