Web & APIs

cookie

A cookie is a tiny note a website asks your browser to keep — and to hand back, automatically, every time you visit that same site again. It's how the web remembers you. HTTP itself is forgetful: each request arrives as if you'd never been there before, so the site slips you a little name tag and your browser quietly clips it on for next time.

The classic job is staying logged in. When you sign in, the server sends back a cookie holding something like a session id or a token. From then on your browser attaches that cookie to every request, and the site goes 'ah, it's you' — no need to type your password on every single page.

It's just a small piece of text the site sets and your browser stores, scoped to that one domain. Cookies aren't programs and can't read your files; they're more like a coat-check ticket the site handed you, that you politely show again each time you come back.

# server's reply sets the cookie:
Set-Cookie: session_id=a1b2c3; HttpOnly; Secure

# your browser sends it back on the next request:
Cookie: session_id=a1b2c3

The site hands you a name tag once; your browser shows it on every visit after.

HttpOnly keeps JavaScript from reading a cookie (a guard against theft); Secure means it's only sent over https. Worth setting on anything that proves who you are.

Also called
http cookiebrowser cookiesession cookieset-cookie