A session cookie is a small, temporary piece of data that a website stores in your browser to remember who you are and what you’re doing just for the duration of that visit (the “session”).

Simple definition

  • A session cookie lives only while your browser (or tab) is open and is deleted when you close it.
  • It usually holds a random session ID that lets the server link you to your temporary data, like login state or cart contents.

How it works (step‑by‑step)

  1. You open a website; the server starts a new session for you.
  1. The server generates a random session ID and sends it to your browser as a session cookie.
  1. Your browser sends that cookie back with each request, so the site “remembers” you across pages.
  1. When you close the browser or log out, the session ends and the cookie is deleted.

What session cookies are used for

  • Keeping you logged in while you click around a site.
  • Remembering items in a shopping cart during checkout.
  • Preserving choices like language or form progress for that visit.

Session vs persistent cookies (quick view)

Type Lifetime Typical uses Storage behavior
Session cookie Only while the session is open; deleted when browser closes Login state, cart contents, in- session preferences Stored in temporary memory; not meant to remain after closing
Persistent cookie Stays after closing browser until its set expiry date “Remember me” logins, long- term preferences, analytics Stored on disk so it survives future visits
[7][5][9][3]

Privacy & legal angle

  • Session cookies are generally considered less intrusive because they are short-lived and often strictly necessary for core site functions.
  • Under laws like GDPR, “strictly necessary” session cookies may not require prior consent, while non-essential tracking cookies usually do.

Information gathered from public forums or data available on the internet and portrayed here.