Protocols
Saved & recent

HTTP cookies

Also called: browser cookies, Set-Cookie, session cookie

A cookie is a small piece of state a browser stores and sends with eligible later requests. A server can set it using Set-Cookie; the browser’s Cookie field carries the stored name and value. Domain, path, lifetime and other rules determine when it is included.

For a hypothetical signed-in session, the browser stores an opaque session identifier, while the server associates that identifier with an account. Secure restricts sending to secure transport, HttpOnly restricts script access, and SameSite limits certain cross-site sending. These attributes address different risks; a cookie itself is neither encryption nor proof that the current holder is authorized.

Read first
HTTP headers
Related
HTTP headers, Authentication, CORS, Session, Cross-site request forgery
Further reading
MDN — Using HTTP cookies
browser server Set-Cookie: sid=opaque login response sid=opaque cookie jar eligible request · Cookie: sid=opaque opaque ID session data server lookup Secure secure transport HttpOnly script access restricted SameSite cross-site use scoped
A fictitious opaque cookie value links eligible browser requests to server-side session data. Secure, HttpOnly, and SameSite govern different behaviors; the cookie is not the server’s session record or encryption.

View in the full Protocols collection