Cookie Security Calculator
Score a session cookie on Secure, HttpOnly, SameSite, prefix, scope, lifetime and rotation, and list the flags you are missing.
Inputs
Weight 20
Weight 18
Weight 8
Weight 6
Weight 4
Weight 12
Cookie Score
69/ 100
Cookie Grade
C — Fair
Missing Key Flags
__Host- prefix, rotation on login
Session Theft Exposure
Low — script and cross-site access are both blocked
Lifetime Assessment
Acceptable for a standard web session
Residual Exposure
31%
Step by step
Values used
Secure flag set = Yes; HttpOnly flag set = Yes; SameSite attribute = Lax — 14; __Host- prefix used = No; No Domain attribute, so no subdomain sharing = Yes; Path scoped to the application root or narrower = Yes; Rotated on login and privilege change = No; Cookie lifetime = 24 hours
Cookie Security
Cookie score = 20 Secure + 18 HttpOnly + SameSite (20 Strict, 14 Lax, 4 None, 0 unset) + 8 __Host- prefix + 6 no Domain attribute + 4 path scoping + 12 rotation on login + lifetime score (12 at ≤1 h down to 0 above a week) = 100.
Cookie Score
= 69 / 100
Cookie Grade
= C — Fair
Missing Key Flags
= __Host- prefix, rotation on login
Session Theft Exposure
= Low — script and cross-site access are both blocked
Lifetime Assessment
= Acceptable for a standard web session
Residual Exposure
= 31
How it works
Secure and HttpOnly carry the most weight because they close the two ways a cookie leaves the browser without the user acting: a plaintext request and an injected script. SameSite is scored on a sliding scale, and the lifetime term rewards short sessions since it directly bounds how long a stolen cookie is worth stealing. Session cookies are the credential for the rest of the visit, so a missing flag converts a minor bug elsewhere — one mixed-content request, one XSS — into account takeover.
Formula
Cookie Security
Cookie score = 20 Secure + 18 HttpOnly + SameSite (20 Strict, 14 Lax, 4 None, 0 unset) + 8 __Host- prefix + 6 no Domain attribute + 4 path scoping + 12 rotation on login + lifetime score (12 at ≤1 h down to 0 above a week) = 100.
- HttpOnly
- Blocks document.cookie access from injected script
- __Host-
- Forces Secure, no Domain and path '/'
Frequently Asked Questions
How is Cookie Security calculated?
Cookie score = 20 Secure + 18 HttpOnly + SameSite (20 Strict, 14 Lax, 4 None, 0 unset) + 8 __Host- prefix + 6 no Domain attribute + 4 path scoping + 12 rotation on login + lifetime score (12 at ≤1 h down to 0 above a week) = 100. Secure and HttpOnly carry the most weight because they close the two ways a cookie leaves the browser without the user acting: a plaintext request and an injected script. SameSite is scored on a sliding scale, and the lifetime term rewards short sessions since it directly bounds how long a stolen cookie is worth stealing.
Why does Cookie Security matter?
Session cookies are the credential for the rest of the visit, so a missing flag converts a minor bug elsewhere — one mixed-content request, one XSS — into account takeover.
What values do I need to enter?
This calculator takes 8 inputs: Secure flag set, HttpOnly flag set, SameSite attribute, __Host- prefix used, No Domain attribute, so no subdomain sharing, Path scoped to the application root or narrower, Rotated on login and privilege change, Cookie lifetime. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
What does the __Host- prefix actually buy?
It makes the browser enforce the hardening for you: a cookie named __Host-session is only accepted if it is Secure, has no Domain attribute and has Path=/. That stops a compromised or attacker-controlled subdomain from overwriting your session cookie, which is a cookie-tossing attack that flags alone do not prevent.
You might also need
- HTTP Security Score CalculatorCommonly used together
- Session Fixation Risk CalculatorCommonly used together
- CSRF Risk CalculatorCommonly used together
- TLS Configuration Score CalculatorCommonly used together
- Cross-Site Scripting (XSS) Risk CalculatorCommonly used together
- OWASP Risk CalculatorAlso in Web & API Security