Back to Guides
Guide16 September 2026

What does SameSite do in cookies?

Decloak is an AI-powered web security intelligence platform that scans a site's HTTP/TLS posture, JavaScript, and third-party scripts to produce a report anyone can read. This guide is part of Decloak's library of practical, source-backed security guidance.

In this guide
  1. Key takeaways
  2. What is the SameSite attribute and why does it matter?
  3. How does SameSite change cookie transmission?
  4. What are the possible SameSite values?
  5. What is the default SameSite behavior?
  6. How does SameSite affect cookie creation?
  7. Why is SameSite important for security?
  8. Compatibility considerations
  9. How to implement SameSite correctly
  10. How SameSite interacts with other cookie flags
  11. When to audit SameSite settings
  12. Quick checklist
  13. Summary

Key takeaways

What is the SameSite attribute and why does it matter?

SameSite is a cookie attribute that tells the browser when the cookie may be included in an outgoing request. By limiting cookie transmission to same - site contexts, it mitigates CSRF and reduces unwanted cross - site data leakage.

When SameSite is set, the browser evaluates the request origin before attaching the cookie. Without the attribute, a cookie is sent with every request to its domain. With SameSite, only requests that satisfy the chosen policy will carry the cookie, preventing browsers from automatically attaching authentication cookies to forged cross - site requests.

What are the possible SameSite values?

What is the default SameSite behavior?

If SameSite is omitted, modern browsers treat the cookie as Lax (or a slightly more permissive variant that still blocks most CSRF - prone requests). Relying on the implicit default can lead to inconsistent behavior across browsers, so explicitly setting the attribute is recommended.

Cookies with SameSite=Strict or SameSite=Lax cannot be set via responses to cross - site sub - resource requests; they can only be set on top - level navigations (same - site or cross - site). This prevents an attacker from planting a cookie through a hidden image or script request.

Why is SameSite important for security?

By preventing the browser from automatically attaching authentication cookies to forged cross - site requests, SameSite provides a strong layer of CSRF protection. It also reduces the risk of unintended tracking across sites because the cookie is not sent on most cross - origin requests.

Compatibility considerations

All major browsers support SameSite, but the default value differs. Chrome, Edge, and Opera have adopted Lax as the default, while older versions of Firefox and Safari may treat the attribute as missing. Explicitly setting SameSite=Strict, Lax, or None; Secure ensures consistent behavior across browsers.

How to implement SameSite correctly

Set-Cookie: sessionId=abc123; Path=/; HttpOnly; Secure; SameSite=Strict
  1. Choose the strictest policy that still allows your legitimate workflows.
  2. If you need cross - site usage (e.g., third - party embeds), use SameSite=None; Secure.
  3. Test all authentication flows after changing the attribute to catch any broken functionality.
  4. Deploy the change gradually, monitoring logs for rejected cookies (browsers will drop non - compliant cookies).

When to audit SameSite settings

Run a regular scan of your public endpoints to verify that every Set - Cookie header includes an explicit SameSite value. Decloak’s free scan performs other checks such as HTTP/TLS posture, static HTML analysis, and third - party domain mapping, helping you identify related misconfigurations.

Quick checklist

Summary

SameSite tells browsers when to include a cookie in outgoing HTTP requests. Strict blocks all cross - site usage, Lax allows only safe top - level navigations, and None disables the restriction but requires Secure. Setting it explicitly eliminates browser defaults, provides CSRF protection, and improves overall cookie security.

Free security scan

See what's actually exposed on your site.

Decloak's free scan runs in about 15 seconds, no account required, and covers:

  • HTTP/TLS security posture
  • JavaScript CVEs
  • Exposed Supabase/Lovable/Base44 misconfigurations
  • AI-written executive summary