Skip to content

Menu

Set-Cookie Builder

Free Set-Cookie header builder. Pick SameSite, Secure, HttpOnly, Partitioned and expiry, and see live checks for __Host- and __Secure- prefix rules.

Runs entirely in your browserAPI & HTTPFree, no sign-up
Loading tool
Checks on a Set-Cookie headerThe tool builds the header from your choices and flags what a browser would reject, following RFC 6265bis and CHIPS.Name and valuetoken and cookie-octetsname + value over 4096 bytes → errorMax-Age or ExpiresMax-Age wins; 0 or less deletesover 400 days → capped by browsersSameSite=None or Partitionedwithout Secure → dropped__Secure-needs Secure__Host-Secure, Path=/, noDomainSet-Cookie header
The tool builds the header from your choices and flags what a browser would reject, following RFC 6265bis and CHIPS.

01What is Set-Cookie Builder?

Set-Cookie Builder writes a Set-Cookie response header from a short form. You enter a name and value, then choose Domain, Path, Max-Age or Expires, SameSite, and the Secure, HttpOnly and Partitioned flags. The header updates as you type, and a list below it explains what each choice means and flags anything a browser would reject or ignore. The checks follow the RFC 6265bis draft and the CHIPS proposal for partitioned cookies. The name must be an HTTP token, and the value may only use cookie-octets, optionally wrapped in double quotes, so spaces, commas, semicolons and backslashes are flagged. Name plus value over 4096 bytes is an error, as is a Domain, Path or Expires value over 1024 bytes. Max-Age must be a whole number. Zero or a negative number deletes the cookie, and a lifetime over 400 days is noted because browsers cap it there. When both Max-Age and Expires are set, the tool reminds you that Max-Age wins. SameSite=None without Secure and Partitioned without Secure are both errors, since browsers drop those cookies. If SameSite is left unset, the tool says so: Chrome and the draft treat it as Lax, but not every browser does. Name prefixes get their own rules. A __Secure- cookie needs Secure. A __Host- cookie needs Secure, Path=/ and no Domain, which pins it to the exact host that set it. Here is a worked example. Enter the name __Host-sid and the value abc123, set Path to /, tick Secure and HttpOnly, and pick SameSite Lax. The header reads __Host-sid=abc123; Path=/; Secure; HttpOnly; SameSite=Lax. There are no errors or warnings. One note says this is a session cookie, because it has no Max-Age or Expires. Untick HttpOnly and a warning appears, since page JavaScript could then read the cookie. The tool has limits. It does not know the URL your server runs on, so it cannot tell whether a Domain value matches it or whether the page is served over HTTPS. Browser behaviour also differs in places, and the draft is not yet a final RFC. To read a header you already have, use the Cookie Parser. Everything runs in your browser and nothing is sent anywhere.

Backend and full-stack developers who set cookies for sessions, preferences or embedded widgets. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Set-Cookie Builder

  1. Pick an example or press Reset to start from an empty form
  2. Enter the cookie name and value
  3. Set Path, Domain and an expiry with Max-Age or Expires if you need them
  4. Choose SameSite and tick Secure, HttpOnly or Partitioned
  5. Read the checks and fix anything marked as an error
  6. Copy the finished Set-Cookie header

03Worked examples

Input: Name __Host-sid, value abc123, Path /, Secure, HttpOnly, SameSite Lax
Result: __Host-sid=abc123; Path=/; Secure; HttpOnly; SameSite=Lax
No errors or warnings. The info note says it is a session cookie.
Input: Name __Host-embed, value xyz, Max-Age 86400, Path /, Secure, SameSite None, Partitioned
Result: __Host-embed=xyz; Max-Age=86400; Path=/; Secure; SameSite=None; Partitioned
A partitioned cookie for a cross-site embed.
Input: Name remember_me, value u42.tok, Expires Wed, 01 Dec 2027 00:00:00 GMT, Domain example.com, Path /, Secure, HttpOnly, SameSite Strict
Result: remember_me=u42.tok; Expires=Wed, 01 Dec 2027 00:00:00 GMT; Domain=example.com; Path=/; Secure; HttpOnly; SameSite=Strict
A persistent cookie shared with subdomains through Domain. No errors, warnings or notes.
Input: Name __Host-tracker, value 1, Domain example.com, Path /app, SameSite None
Result: __Host-tracker=1; Domain=example.com; Path=/app; SameSite=None error: SameSite=None requires Secure. Browsers reject the cookie otherwise. error: A __Host- cookie must have Secure. error: A __Host- cookie must not have a Domain attribute. error: A __Host- cookie must have Path=/.
Browsers would reject this cookie. Output shortened to the errors; it also warns about missing HttpOnly and Secure.
Input: Name theme, empty value, Max-Age 0, Path /, Secure, SameSite Lax
Result: theme=; Max-Age=0; Path=/; Secure; SameSite=Lax info: Max-Age of zero or less deletes the cookie straight away. warning: No HttpOnly, so page JavaScript can read this cookie. Add it for session cookies.
Max-Age=0 is how a server deletes a cookie. Path must match the original cookie for the delete to work.

04Common use cases

  • Writing the session cookie for a login endpoint with __Host-, Secure, HttpOnly and SameSite=Lax
  • Setting up a partitioned cookie for a widget embedded on other sites
  • Working out the header that deletes a cookie with Max-Age=0
  • Checking why a browser drops a SameSite=None cookie
  • Teaching what each Set-Cookie attribute does during a code review

05Tips

  • Use the __Host- prefix for session cookies when you do not need subdomains to share them.
  • Set SameSite explicitly rather than relying on each browser's default.
  • Partitioned cookies need Secure, and cross-site use usually also needs SameSite=None.
  • To delete a cookie, send the same name, Path and Domain with Max-Age=0.

06Related concepts

RFC 6265bis, SameSite, CHIPS, __Host- prefix, HttpOnly, Max-Age.

Frequently Asked Questions

What is Set-Cookie Builder?

Set-Cookie Builder is a free, browser-based developer tool on AIDToolStack. Free Set-Cookie header builder. Pick SameSite, Secure, HttpOnly, Partitioned and expiry, and see live checks for __Host- and __Secure- prefix rules. It requires no installation or sign-up and works entirely in your browser.

Is Set-Cookie Builder free to use?

Yes. No sign-up, no fees and no usage cap.

Does Set-Cookie Builder store my data?

No. It runs in your browser; nothing is uploaded.

Related Tools

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe