← Glossary

What Are SameSite Cookies?

SameSite cookies carry the SameSite attribute, which tells the browser whether to include the cookie on requests that cross from one site to another. Strict, Lax and None define three policies, and the attribute's meaning of site is the registrable domain plus scheme, not the full origin.

Updated:

SameSite cookies are cookies whose Set-Cookie header includes the SameSite attribute, and the attribute answers one question: when a request is caused by a different site than the one the cookie belongs to, should the browser attach the cookie? Before the attribute existed, cookies went along with every matching request regardless of where the request originated, which is the mechanism behind cross-site request forgery and much of third-party tracking. SameSite lets the server declare a policy. Strict withholds the cookie from all cross-site requests, Lax permits it on top-level navigations with safe methods, and None removes the SameSite restriction when Secure is also set. Other cookie scope and browser policy checks still apply. The attribute is widely supported and Lax is treated as the default in several browsers when nothing is specified, which has made its definition of site and its exceptions a matter of everyday relevance.

Site Context and Request Types

The attribute's unit is the site, and the site is not the origin. MDN's glossary defines an origin as the combination of scheme, full hostname and port, used by the browser for security decisions such as which resources a script can access. A site is coarser: it is the registrable domain, meaning one entry from the Public Suffix List plus the label immediately before it, and under the schemeful definition that browsers apply to SameSite, the scheme as well. Under that definition, pages on two subdomains of the same registrable domain are same-site, two origins that differ only in port are same-site, and http and https versions of one host are different sites. A request from a sibling subdomain to the cookie's host can therefore be same-site, provided the schemes match. Domain, Path and other cookie restrictions still apply; SameSite does not make a host-only cookie readable or sendable to every subdomain. This distinction matters for sites that place untrusted content on subdomains.

Classification depends on the destination and the request's initiating context. For a simple top-level page, comparing its scheme and registrable domain with the destination gives the basic distinction. Embedded frame ancestry and navigation or redirect rules add details that cannot be reduced to the destination URL alone. A link clicked on another site, a form posted from another site, an image or script embedded on another site, and a fetch made by another site's script are all cross-site requests toward the cookie's site. The request's method also matters for Lax, as the next section explains.

Strict, Lax and None

ValueSent on same-site requestsSent on cross-site top-level navigationSent on cross-site embedded requests and POSTsRequirements
StrictYesNoNoNone
LaxYesYes, if the method is safe such as GETNoNone; default in some browsers when unspecified
NoneYesYesYesSecure attribute required

SameSite Strict is the most restrictive. A navigation from another website can arrive without a Strict cookie, so the application may initially appear logged out, which is why Strict suits cookies that guard sensitive actions rather than the cookie that shows a personalised home page. SameSite Lax relaxes exactly that case: the cookie is sent when the user navigates to the site at the top level with a safe method, so a followed link lands the user logged in, but cross-site POST submissions, embedded images, iframes and background fetches do not carry it. MDN also documents a transitional behaviour in browsers that apply Lax by default: a recently set cookie may additionally be sent on cross-site top-level POST navigations within a two-minute grace period, to avoid breaking login flows that redirect through another site.

SameSite None Secure is the explicit opt-in to cross-site use. Embedded widgets, single sign-on providers and third-party services that need their cookie inside another site's page must set None, and because None without Secure is rejected, such cookies require a secure setting context, with supported localhost exceptions for development. The MDN cookie guide states the rule directly: if SameSite None is set, the Secure attribute must also be set.

SameSite Compared With Third-Party Cookie Restrictions

SameSite and the browsers' third-party cookie policies both concern cross-site behaviour, and they operate independently. SameSite is a per-cookie instruction from the server about when the browser should send the cookie. Third-party cookie blocking and partitioning are browser-level policies about whether cross-site cookies are stored and sent at all, regardless of what the server asked for. A cookie marked None and Secure is a request to be sent cross-site; Firefox, with Total Cookie Protection enabled by default, still partitions it per top-level site, Safari still blocks it under Intelligent Tracking Prevention, and Chrome sends it unless the user has blocked third-party cookies or is in Incognito, where they are blocked by default. The attribute cannot override those policies. For embedded services that need cross-site state, the current mechanisms are the Partitioned attribute, which gives a cookie a separate jar per top-level site, and the Storage Access API, which lets an embedded frame request unpartitioned access subject to user activation, grants and browser policy.

Where Each Value Fits

Lax can suit a session that should be available on incoming top-level links. Strict provides a narrower sending rule when the application can accommodate it. Sensitive operations still need their own CSRF and authorisation checks; a cookie setting is not a substitute. Analytics cookies that only need first-party context are Lax. Cookies that genuinely need cross-site embedded access use None with Secure, and increasingly also Partitioned where sharing across top-level sites is not required. Setting the value explicitly on every cookie removes the dependence on browser defaults, which differ: MDN notes that some browsers treat an unspecified attribute as Lax, and the OWASP session management guidance asks for an explicit Strict or Lax on session cookies.

Limits of the Attribute

SameSite narrows when a cookie is sent; it does not authenticate requests. Lax still permits cross-site GET navigations, so an application that changes state on GET remains forgeable. Same-site is broader than same-origin, so a vulnerable or attacker-controlled subdomain is inside the boundary. In browsers implementing it, the two-minute default-Lax exception can send recently set cookies on cross-site top-level POST navigations. Explicit SameSite=Lax does not opt into that default-only grace period. Browsers that do not support the attribute ignore it. For these reasons OWASP treats SameSite as defence in depth against CSRF and not as a replacement for anti-forgery tokens. The attribute also says nothing about storage, script access or transport; those belong to the browser's cookie policies and to the HttpOnly and Secure attributes respectively. SameSite is a precise tool for one problem, the automatic attachment of cookies to requests another site caused, and it is most useful when set deliberately on every cookie with that problem in mind.

Frequently asked questions

Is same-site the same as same-origin?

No. SameSite normally compares scheme and registrable domain, whereas an origin also distinguishes subdomains and ports. This does not share a cookie across subdomains: its Domain, Path and other rules still determine which requests can carry it.

Does SameSite=None guarantee a cookie will be sent?

No. None is a request to send the cookie cross-site, and it requires Secure. Browser policies still decide: Firefox partitions such cookies per top-level site, Safari blocks most of them, and Chrome blocks them in Incognito or when the user disables third-party cookies.

Can SameSite replace every CSRF defense?

No. Lax allows cross-site safe top-level navigations, same-site sibling domains remain within the boundary, and browser behaviour varies. Keep state changes off GET endpoints and apply appropriate CSRF controls; SameSite supplements those controls rather than replacing them.

What happens if no SameSite value is set?

Some browsers apply Lax by default. Certain implementations allow recently set cookies on cross-site top-level POST navigations for two minutes, a grace period not granted by explicit Lax. Setting an intentional value avoids relying on changing defaults.

Why would a Strict cookie make a user appear logged out?

A navigation from another website normally omits the Strict cookie on its initial request. If the application relies on that cookie to render the response, it may appear logged out. How the session becomes visible again depends on subsequent requests and application behaviour.