Shahin

Cookie

Beginner
Updated Jul 11, 2026 Shahin editorial 2 min read
PronunciationEN/ˈkʊki/

A cookie is a small piece of data that a site stores in the browser, and the browser sends it back on later requests to the same domain.

A cookie is written either by the server through the Set-Cookie header or by JavaScript in the browser, and attributes such as Domain, Path, Expires, SameSite and Secure govern its scope and lifetime. The decisive split is first-party versus third-party: a first-party cookie belongs to the domain the visitor is already on and is what identifies a returning visitor, while a third-party cookie is written by another domain and is now widely blocked by browsers. The common error is to treat a cookie as a person; policies such as Intelligent Tracking Prevention in Safari cut the lifetime of a script-written cookie to a few days, so the same person is counted as a new visitor when they come back.

FAQ

Sources:MDN — Using HTTP cookies