Set Cookie Builder
Compose RFC 6265 Set-Cookie headers with Path, Domain, Max-Age, Secure, HttpOnly, and SameSite.
Compose Set-Cookie response headers
Servers set session and preference cookies with the HTTP Set-Cookie response header defined in
RFC 6265. Attributes such as Path,
Domain, Max-Age, Secure, HttpOnly, and SameSite
control lifetime, scope, and cross-site behavior.
Encoding and security flags
Toggle URL encoding when values contain = or reserved characters. Enable Secure for HTTPS-only
delivery and HttpOnly to keep tokens out of JavaScript. SameSite=None requires Secure
in modern browsers for cross-site use cases.
To inspect inbound or outbound cookie headers, use the Cookie Parser.
Frequently Asked Questions
Should I set both Expires and Max-Age?
Browsers accept either or both. Max-Age is often preferred because it is a relative duration in seconds. Leave one empty if you only need a single lifetime mechanism.
What does Partitioned mean?
The Partitioned attribute supports CHIPS (Cookies Having Independent Partitioned State), scoping third-party cookies per top-level site.
Is this a substitute for framework cookie APIs?
Use this builder to prototype header strings or debug APIs. Production apps should still set cookies through vetted server libraries with signing and rotation policies.