CookieLens
Unlimited Free Usage No signup · No paywall · Everything runs in your browser

Set-Cookie Inspector & Security Audit

Paste one or many Set-Cookie response headers and CookieLens decodes every attribute, tells you when each cookie actually expires, and runs a cookie security checker audit with a 0–100 score — plus a one-click hardened rewrite of each header.

Paste Set-Cookie headers

One per line · Set-Cookie: prefix optional
⚙️ Hardened header generator — applied to every cookie below

👆 Paste headers above and hit Inspect Cookies — your decoded dashboard appears here.

What Is a Set-Cookie Header, Really?

Every time you log in to a website, add something to a cart, or dismiss a banner, there is a quiet conversation happening between your browser and the server. The server's most important sentence in that conversation is the Set-Cookie response header. It is a single line of text that tells the browser: remember this name and value, send it back with future requests, and here are the rules for how long it lives and where it may travel. A typical header looks like sessionid=abc123; Path=/; Secure; HttpOnly; SameSite=Lax — compact, precise, and easy to misread if you don't know what each attribute does.

The problem is that real-world Set-Cookie headers are rarely that tidy. Production headers pile on attributes, expire dates in a format nobody uses anywhere else, integer lifetimes, domain scoping rules, and flags with no values at all. When you are debugging an authentication bug, auditing a client's site, or reviewing your own code, staring at a raw header string is slow and error-prone. That is exactly why a set-cookie decoder online exists: you paste the raw header, and the tool breaks it into a clean attribute table so you can see — at a glance — the cookie's name, value, domain scope, path scope, lifetime, and every security flag.

Decoding a Cookie Header by Hand vs. Using a Cookie Header Parser

You can decode a cookie header manually, of course. Split the string on semicolons, treat the first segment as the name=value pair, and classify everything after it as attributes. But the devil is in the details. The Expires attribute contains a comma (Wed, 21 Oct 2026 07:28:00 GMT), which breaks naive parsers that split on commas. The Max-Age attribute is a duration in seconds, not a date, and when both are present Max-Age silently wins. Boolean flags like Secure and HttpOnly carry no value at all, so a parser that expects key=value everywhere will misclassify them. Quoted values, base64 payloads with = padding, and attribute names in unexpected cases (httponly, SECURE) add more traps.

A purpose-built cookie header parser handles all of this for you. It normalizes attribute names case-insensitively, strips the optional Set-Cookie: field prefix, unquotes DQUOTE-wrapped values, splits name and value on the first equals sign so base64 padding survives, parses HTTP dates into real timestamps, validates Max-Age integers, and flags attributes it does not recognize instead of silently dropping them. For batch work — pasting ten headers from a response dump — it processes every line independently and reports per-cookie results plus an aggregate summary. That is the difference between ten minutes of squinting and ten seconds of clarity.

Every Set-Cookie Attribute, Explained

Name and value. The core payload. Names should be RFC 6265 tokens; the value is opaque to the browser but often contains session IDs, JWTs, or preference strings. Empty values are legal and are commonly used as deletion markers.

Domain. Controls which hosts receive the cookie. Without it, the cookie is host-only and goes back solely to the exact domain that set it. With Domain=.example.com, subdomains like app.example.com get it too. The leading dot is legacy syntax — modern browsers ignore the dot but still apply subdomain scope.

Path. Narrows the cookie to URL paths. Path=/ means the whole site; omitting it defaults to the request path that set the cookie, which surprises many developers when their cookie "disappears" on other pages.

Expires and Max-Age. Two ways to say "how long". Expires is an absolute HTTP date; Max-Age is a relative number of seconds from now. If both are present, Max-Age wins. A negative Max-Age deletes the cookie. And since 2022, browsers cap persistent cookie lifetimes at 400 days (RFC 6265bis) — anything longer gets truncated, no matter what your server asked for.

Secure. The cookie is only sent over HTTPS. Without it, the cookie value travels in plain text on HTTP connections and can be sniffed on public Wi-Fi. This is the single most impactful flag on the list.

HttpOnly. Hides the cookie from JavaScript (document.cookie). It does not stop all attacks, but it neutralizes the most common XSS payload — stealing the session token — by keeping it out of the DOM entirely.

SameSite. Your CSRF shield. Lax sends the cookie on top-level navigations but not on cross-site subrequests; Strict never sends it cross-site at all; None allows cross-site use but requires Secure. Browsers default to Lax when the attribute is missing, but relying on the default instead of setting it explicitly is a code smell auditors love to flag.

Partitioned. The CHIPS attribute (Cookies Having Independent Partitioned State). It lets embedded third-party content set cookies keyed to the top-level site, so the same embed on two different sites gets two isolated cookie jars. It requires both Secure and SameSite=None — miss either and browsers ignore or reject it.

Why a Cookie Security Checker Score Matters

Knowing what the attributes mean is step one; judging whether a cookie is safe is step two. A cookie security checker applies a consistent audit to every cookie: is Secure present? Is HttpOnly set on anything session-like? Is SameSite explicit? Does SameSite=None have its mandatory Secure partner, or will browsers reject the cookie outright? Is the lifetime within the 400-day cap? Is Max-Age even a valid integer?

CookieLens scores each cookie from 0 to 100 and grades it A through F. Missing Secure costs 30 points — a high-severity finding, because a session cookie without Secure is one open network away from account takeover. Missing HttpOnly costs 20 points — high severity for session tokens, since any reflected XSS becomes a full session theft. A missing SameSite attribute costs 15 points at medium severity: browsers will guess Lax, but explicit beats implicit when you are defending against CSRF. The deadliest combination, SameSite=None without Secure, is flagged as high severity on its own — Chrome, Edge, Firefox, and Safari all reject such cookies, so the feature you thought you shipped is silently broken for everyone.

The audit also catches quieter issues: negative Max-Age values that delete cookies on arrival, expiries beyond the 400-day browser cap, missing Path attributes that scope cookies too narrowly, empty values, non-token characters in names, and unrecognized attributes that browsers will ignore. Each finding carries a plain-English explanation, so the report doubles as a learning tool for developers who inherited a cookie setup they didn't write.

The SameSite=None Without Secure Trap

This deserves its own section because it is the single most common cookie bug in production. A developer embeds a widget, a payment iframe, or a cross-site SSO flow, and learns they need SameSite=None for the cookie to travel cross-site. They add it, test on localhost — where browsers relax the Secure requirement — and everything works. Then they deploy to production, and the cookie vanishes. No error in the application logs, no crash; the browser simply refuses to store a SameSite=None cookie that lacks Secure. Sessions break, logins loop, and the debugging session begins in the wrong place entirely.

CookieLens flags this combination explicitly and at high severity, because it is both a security finding and a functionality bug. The fix is mechanical: add Secure (and serve over HTTPS, which you should be doing anyway), or reconsider whether the cookie needs to be cross-site at all — SameSite=Lax is the right default for first-party session cookies, and Strict suits high-sensitivity flows like banking dashboards.

Reading Expiry Like a Human

Raw expiry data is hostile to humans. Max-Age=31536000 is a year, but you have to do the math. Expires=Wed, 21 Oct 2026 07:28:00 GMT is precise but tells you nothing about how far away that is. CookieLens translates both into plain language — "expires in 3 days", "expired 2 hours ago" — computed against the current time. It also tells you which mechanism is in force when both are present, warns when a lifetime exceeds the 400-day cap, and marks session cookies (no Expires or Max-Age at all) as dying with the browser tab.

This matters beyond curiosity. Stale expiries are a real operational hazard: a cookie set to expire in 2038 will be silently truncated by the browser, and a cookie your server thinks is persistent may actually be a session cookie because the Expires date was malformed and ignored. Humanized expiry turns these silent failures into visible ones.

From Audit to Fix: The Hardened Header Generator

Finding problems is only half the job, so CookieLens includes a hardened header generator. For each parsed cookie it produces a best-practice rewrite: it preserves your name, value, domain, and lifetime, then applies Secure, HttpOnly (toggleable, for cookies your JavaScript legitimately needs to read), an explicit SameSite policy (Lax by default, Strict or None on demand), a sensible Path=/ default, and optional Partitioned for CHIPS use cases. One click copies the rewritten header, ready to paste into your server configuration or framework's cookie options.

This closes the loop that most cookie tools leave open: decode, understand, audit, and then immediately generate the fixed version. For teams doing security reviews, the workflow is paste → inspect → copy hardened headers into the ticket. For solo developers, it is the fastest way to bring a legacy cookie setup up to modern best practice without memorizing the RFC.

A Practical Workflow for Developers and Auditors

Here is how CookieLens fits into real work. Debugging login issues: open your browser's devtools, copy the Set-Cookie response headers from the Network tab, paste them into CookieLens, and check whether the session cookie is actually being stored — expired dates, rejected SameSite=None cookies, and domain mismatches show up immediately. Security audits: paste every Set-Cookie header your application emits and review the aggregate findings — any high-severity item is a ticket. Code review: when a pull request touches cookie configuration, decode the resulting headers and confirm the flags match the intent. Learning: if you are new to web security, paste headers from sites you use and read the findings — it is the fastest practical education in cookie security available.

Everything happens in your browser. CookieLens never sends your headers anywhere — there is no server, no analytics on your input, no account. Paste, inspect, copy the hardened version, and move on. That privacy guarantee matters: Set-Cookie headers often contain live session tokens, and you should never paste those into a tool that phones home.

Cookie Security Checklist (The Short Version)

If you take one thing from this page, take the checklist: always set Secure; always set HttpOnly unless JavaScript must read the cookie; always set SameSite explicitly (Lax by default, Strict for sensitive flows); never pair SameSite=None with a missing Secure; prefer Max-Age over Expires for new code; keep lifetimes at or under 400 days; scope Path and Domain as narrowly as your app allows; and re-audit whenever your cookie setup changes. Paste your headers into the inspector above, fix what it flags, and ship with confidence.

Frequently Asked Questions

What does a Set-Cookie decoder do? +

A Set-Cookie decoder takes a raw Set-Cookie response header — like sessionid=abc; Path=/; Secure; HttpOnly; SameSite=Lax — and breaks it into a readable table of name, value, Domain, Path, Expires/Max-Age, Secure, HttpOnly, SameSite, and Partitioned. CookieLens goes further by humanizing expiry times ("expires in 3 days"), auditing each cookie's security with a 0–100 score, and generating a hardened rewrite of the header.

Why is SameSite=None without Secure a problem? +

Modern browsers reject any cookie marked SameSite=None that does not also carry the Secure flag. The cookie is silently dropped — your server thinks it set it, but the browser never stores it. This commonly breaks cross-site widgets, embedded checkouts, and SSO flows that were tested on localhost (where browsers relax the rule) but fail in production. CookieLens flags this combination at high severity.

What is the difference between Expires and Max-Age? +

Expires sets an absolute date and time when the cookie dies; Max-Age sets a relative lifetime in seconds from the moment it is received. When both are present, Max-Age takes precedence. A cookie with neither is a session cookie that disappears when the browser closes. Note that browsers cap persistent cookie lifetimes at 400 days regardless of what the server requests.

How is the cookie security score calculated? +

Each cookie starts at 100 and loses points per finding: missing Secure costs 30 (high severity), missing HttpOnly costs 20 (high), SameSite=None without Secure costs 25 (high), missing SameSite costs 15 (medium), and lifetime or attribute issues cost 5–10. Scores map to grades A (90+) through F (below 60), so you can triage a whole batch at a glance.

Can I inspect multiple cookies at once? +

Yes. Paste one Set-Cookie header per line — CookieLens parses each independently, renders a dashboard card per cookie with its own attribute table, audit findings, and hardened rewrite, and shows an aggregate summary strip with the total count, average score, and finding severity counts.

Is it safe to paste cookies containing session tokens? +

CookieLens runs entirely in your browser — there is no backend, no database, and no network request carrying your input anywhere. The parsing, auditing, and header generation all happen locally in JavaScript. That said, as a general habit, prefer pasting headers from test or staging environments over production session tokens whenever you can.