Web Development web security authentication

What is Cookie?

Definition

An HTTP cookie is a small piece of data stored in the browser and sent with every request to the same domain. Cookies store session IDs, authentication tokens, preferences, and tracking identifiers. They are set via the Set-Cookie response header.

Why It Matters

Cookies are the mechanism for maintaining state in the stateless HTTP protocol. HttpOnly cookies protect against XSS token theft. SameSite cookies prevent CSRF attacks. Understanding cookie attributes (Secure, HttpOnly, SameSite, Path, Domain) is essential for web security.

Related Free Tools

Related Terms