Build a Set-Cookie header for a session: prefixes, SameSite, Domain, lifetime and the Partitioned attribute, with what each choice gives up.
Nothing here weakens the cookie
Secure, HttpOnly, SameSite=Lax, host-only. Server-side revocation is still your responsibility.
A cookie name is a token: no spaces and none of ( ) < > @ , ; : \ " / [ ] ? = { }. The prefix is added for you.
__Host- requires Path=/, so this is fixed. The browser enforces it: a __Host- cookie with any other path is dropped without an error.
__Host- forbids Domain entirely, which is what makes it the strongest prefix: the cookie is locked to the exact host that set it.
Sent over HTTPS only. Without it the cookie travels in clear text on any plain HTTP request to the host, including one an attacker triggers.
Hidden from document.cookie. This is what stops a cross-site scripting bug from turning into stolen sessions, so it is the one attribute never worth trading for convenience.
Gives the cookie a separate jar per top-level site when it is used in an embedded context. Relevant only alongside SameSite=None; it is how a legitimate third-party cookie keeps working as unpartitioned ones are phased out.
Set-Cookie: __Host-session=<value>; Path=/; HttpOnly; Secure; SameSite=LaxSent on a top-level navigation with a safe method, withheld from cross-site subresource requests and form posts. The browser default when the attribute is absent, and the right choice for a session cookie.
No Max-Age and no Expires. The cookie lives until the browser is closed — though browsers that restore sessions on launch keep it anyway, so this is weaker than it sounds.
The __Host- prefix constrains the cookie
A browser only accepts a `__Host-` cookie when it is Secure, has `Path=/`, and has NO Domain attribute — which also means it cannot be shared with a subdomain. That is the point: it cannot be set by a subdomain either, which closes off cookie-tossing from a compromised sibling host. Path and Domain above follow that rule rather than the values given.
This is a session cookie
With no Max-Age the cookie is dropped when the browser session ends — except that most browsers restore session cookies along with tabs, so “until the browser closes” is not something to rely on for a security boundary. Server-side expiry is what actually ends a session.
The value is written as <value> deliberately. A session identifier must come from a cryptographic random source on your server and must never be derived from anything about the user — so this tool does not generate one, which would invite pasting a value from a web page into a real system. Nothing is sent anywhere and no cookie is set in your browser by this page.
This builds a header. Nothing is set, sent or stored, and no browser storage is touched.
A cookie's attributes are not returned to the server on subsequent requests — only its name and value. So nothing can read back how a cookie was configured; the configuration lives only where it was set.
Rotate the session identifier on sign-in and on privilege change. A cookie configured perfectly still allows session fixation if the value survives authentication.
Cookie attributes are one layer. They do nothing about session fixation, rotation on privilege change, server-side revocation, or idle timeout — all of which are decisions in your application rather than in this header. Follow the OWASP Session Management Cheat Sheet and your framework’s current documentation.
Session Cookie Builder runs entirely on your device — the header is assembled in your browser and nothing is stored or transmitted.
You’re on the Free plan. Compare plans
The defaults here are the secure ones — Secure, HttpOnly, SameSite=Lax, no Domain, session lifetime — because a generator whose defaults are permissive teaches the permissive version to everyone who does not read every option. Weakening any of them produces a finding explaining what was given up rather than silently complying.
Domain makes a cookie broader, not narrower, which is the opposite of how most people read it. Omitting it is the restrictive choice: the cookie goes to that exact host only. Setting it to example.com sends your session to every subdomain, including whatever marketing deploys on one next quarter.
The __Host- prefix is the strongest option precisely because it forbids Domain and forces Path=/. The browser enforces that, which means a mismatch causes the cookie to be dropped silently rather than warned about — so the builder adjusts the other fields rather than letting you produce a header that will not work.
No, the reverse. Omitting Domain confines the cookie to the exact host that set it; setting it extends the cookie to that domain and all its subdomains. It is the one cookie attribute whose name suggests the opposite of its effect.
Because current browsers reject a None cookie without it outright. The cookie is simply not stored, which looks like a server bug rather than a policy requirement.
__Host- additionally forbids Domain and requires Path=/, so the cookie is locked to the exact host that set it and cannot be written by a subdomain. __Secure- only requires the Secure attribute.
Because a session identifier must come from a cryptographic random source on your server. Generating one on a web page invites pasting it into a real system, so this tool deliberately does not.
No. Attributes are one layer. Session fixation, rotation on privilege change, server-side revocation and idle timeout are all decisions in your application, and none of them is visible in a Set-Cookie line.
If a tool here saved you some time, you can put something towards the hosting.Buy me a coffee, on Ko-fi, opens in a new tab