SEOlust
Security

Cookie Security Checker

Analyze cookies for Secure, HttpOnly, and SameSite flags. GDPR compliance checker.

All tools

🍪 Cookie Security Checker

Analyze cookies for security attributes. Check Secure, HttpOnly, and SameSite flags for GDPR compliance.

🔍 Cookie Security Attributes

✅ Secure Flag Ensures cookie only sent over HTTPS
🔒 HttpOnly Flag Prevents JavaScript access to cookie
🛡️ SameSite Attribute Prevents CSRF attacks

💡 Why Cookie Security Matters

  • GDPR Compliance: Proper cookie security is required for EU privacy regulations
  • XSS Protection: HttpOnly flag prevents JavaScript from stealing cookies
  • CSRF Prevention: SameSite attribute blocks cross-site request forgery
  • Data Security: Secure flag ensures cookies only sent over encrypted connections
  • Privacy Regulations: Required for CCPA, PECR, and other privacy laws

Free Cookie Security Checker - Analyze Cookie Flags for GDPR Compliance

Our free Cookie Security Checker analyzes website cookies for essential security attributes including Secure flag, HttpOnly flag, and SameSite attribute. Get instant graded results showing which cookies lack proper security configuration, complete with individual cookie scores, security flag coverage percentages, and compliance recommendations. Essential for GDPR and privacy compliance, security audits, web development, and protecting against XSS and CSRF attacks. Includes detailed analysis of each cookie with fix recommendations for missing security flags.

What is Cookie Security?

Cookie security refers to implementing proper security attributes on HTTP cookies to protect user data and prevent attacks. Our Cookie Security Checker analyzes three critical cookie attributes: the Secure flag (ensures cookies only transmitted over HTTPS, preventing interception over HTTP), HttpOnly flag (prevents JavaScript access to cookies, protecting against XSS attacks that steal session cookies), and SameSite attribute (controls when cookies are sent in cross-site requests, preventing CSRF attacks). Modern browsers and privacy regulations like GDPR, CCPA, and PECR require websites to implement these security measures on cookies, especially those containing sensitive data like session IDs, authentication tokens, or personal information. The tool provides graded scoring (A+ to F) based on how many cookies have proper security flags, percentage coverage for each security attribute, individual cookie analysis showing exactly which flags are missing, and specific recommendations for fixing security issues in your cookie implementation. Cookie security is critical for web developers implementing authentication systems, security engineers conducting privacy audits, compliance officers ensuring GDPR/CCPA requirements, DevOps teams configuring secure cookie handling, and website owners protecting user data from theft or manipulation.

Cookie Security Attributes Explained

Understanding the three essential cookie security attributes and why each matters for your website's security posture.

  • Secure Flag: Most fundamental security attribute that instructs browsers to only send the cookie over HTTPS connections, prevents man-in-the-middle attacks where attackers intercept cookies on unsecured networks, absolutely required for any website using HTTPS (which should be all websites), syntax: Set-Cookie: name=value; Secure, browsers will refuse to send Secure cookies over HTTP preventing downgrade attacks, essential for session cookies, authentication tokens, and any sensitive data
  • HttpOnly Flag: Prevents client-side JavaScript from accessing the cookie through document.cookie, critically important defense against XSS (cross-site scripting) attacks, even if attacker injects malicious JavaScript they cannot steal cookies marked HttpOnly, syntax: Set-Cookie: name=value; HttpOnly, should be used on all session cookies and authentication tokens, does NOT affect cookies sent in HTTP requests (server can still read them), reduces impact of XSS vulnerabilities by protecting most sensitive cookies
  • SameSite Attribute: Controls whether cookies are sent with cross-site requests preventing CSRF attacks, three possible values: Strict (most secure, blocks all cross-site cookie sending), Lax (balanced approach, allows cookies on top-level navigation like clicking links), None (allows cross-site cookies but requires Secure flag), syntax: Set-Cookie: name=value; SameSite=Lax, browsers now default to SameSite=Lax if not specified, SameSite=None requires Secure flag or browsers reject it, choose Strict for high-security cookies, Lax for general session cookies, None only when necessary for legitimate cross-site functionality
  • Domain Attribute: Controls which domains can receive the cookie, if not specified defaults to current domain only (most secure), can be set to allow subdomains: Domain=.example.com, be careful with broad domain settings as they increase attack surface, generally leave unspecified unless you specifically need subdomain sharing
  • Path Attribute: Restricts cookie to specific URL paths on your domain, defaults to path that set the cookie, can be broadened with Path=/ to allow entire site, useful for isolating cookies to specific application sections, provides limited security benefit as easily bypassed with XSS
  • Expires and Max-Age: Control cookie lifetime, Expires sets specific date/time for cookie expiration, Max-Age sets number of seconds until expiration (more reliable), without these cookies become session cookies (deleted when browser closes), shorter lifetimes reduce window for attacks if cookie stolen, balance security with user experience (login convenience vs session timeout frequency)

How to Use the Cookie Security Checker

Analyzing your website's cookie security is instant and provides comprehensive security assessment.

  • Enter website URL in input field - works with any HTTP or HTTPS website, automatically adds https:// if not provided, supports testing both your own sites and competitors
  • Click 'Analyze Cookies' button - tool fetches response headers from URL, parses all Set-Cookie headers sent by server, analyzes each cookie's security attributes
  • View overall security grade - A+ to F grade based on average cookie security score, shows total number of cookies found, displays average security score (0-100)
  • Check statistics dashboard - total cookies analyzed, number with secure security (90+ score), number with warnings (70-89 score), number with critical issues (<70 score)
  • Review security flags coverage - Secure flag coverage percentage with progress bar, HttpOnly flag coverage percentage, SameSite attribute coverage percentage, shows how many cookies have each flag out of total
  • Analyze individual cookies - each cookie listed with name and security level, score out of 100 for that specific cookie, visual badges showing Secure/HttpOnly/SameSite status (green checkmark if present, red X if missing), list of specific security issues found, expandable details showing Domain, Path, Expires, Max-Age
  • Read fix recommendations - if issues found shows code examples for adding Secure flag, HttpOnly flag, and SameSite attribute, explains which SameSite value to choose (Strict/Lax/None), notes that SameSite=None requires Secure flag
  • Copy or download report - click 'Copy Report' to get formatted text with all findings, click 'Download Report' to save .txt file with cookie analysis, includes grade, scores, individual cookie details, timestamp

Why Cookie Security Matters

Proper cookie security is essential for privacy compliance, protecting user data, and preventing attacks.

  • GDPR Compliance: EU General Data Protection Regulation requires appropriate technical measures to protect personal data, cookies containing personal info must have proper security attributes, Article 32 specifically mentions security of processing, non-compliance can result in fines up to €20 million or 4% of global revenue, regulators specifically check for Secure and HttpOnly flags in privacy audits
  • CCPA Requirements: California Consumer Privacy Act requires reasonable security for personal information, secure cookies are part of reasonable security measures, CCPA violations can result in $7,500 per intentional violation, consumers can sue for data breaches resulting from inadequate security
  • XSS Attack Prevention: Cross-site scripting attacks try to steal cookies via JavaScript injection, HttpOnly flag prevents attackers from reading cookies even if XSS exists, session hijacking is primary goal of XSS attacks targeting cookies, without HttpOnly attacker steals session and impersonates victim, HttpOnly provides defense-in-depth even when other XSS protections fail
  • CSRF Attack Prevention: Cross-site request forgery tricks victim's browser into making unwanted requests, SameSite attribute blocks cookies from being sent with forged requests, prevents attackers from piggybacking on victim's authenticated session, especially important for state-changing operations (transfers, password changes, purchases), SameSite=Strict provides strongest CSRF protection
  • Session Hijacking Protection: Secure flag prevents session cookies from being intercepted on insecure networks, without Secure flag attacker on WiFi network can steal session cookies, man-in-the-middle attacks can downgrade HTTPS to HTTP to steal cookies, Secure flag ensures cookies never transmitted over unencrypted connection
  • Browser Warnings: Modern browsers show warnings for insecure cookie practices, Chrome blocks cookies without SameSite attribute by default, Firefox and Safari increasingly strict about cookie security, developer console shows warnings for missing security attributes, upcoming browser versions may reject insecure cookies entirely
  • Third-Party Cookie Restrictions: Browsers cracking down on third-party cookies for privacy, SameSite=None cookies (used for cross-site) require Secure flag, Chrome requires Secure flag on all SameSite=None cookies since 2020, proper attributes ensure your cross-site cookies continue working
  • Audit and Compliance: Security audits check cookie configuration as standard practice, penetration testing reports flag cookies without security attributes, PCI-DSS compliance requires proper cookie security for payment applications, SOC 2 audits verify security controls including cookie handling

How to Fix Cookie Security Issues

Implementing proper cookie security attributes depends on your server technology and framework.

  • PHP Implementation: Use setcookie() function with options array: setcookie('name', 'value', ['secure' => true, 'httponly' => true, 'samesite' => 'Lax']), or session_set_cookie_params() for session cookies before session_start(), or set directly in php.ini: session.cookie_secure = 1, session.cookie_httponly = 1, session.cookie_samesite = Lax
  • Node.js/Express Implementation: Use cookie options in Express: res.cookie('name', 'value', { secure: true, httpOnly: true, sameSite: 'lax' }), for express-session: session({ cookie: { secure: true, httpOnly: true, sameSite: 'lax' } }), in production ensure secure is true (requires HTTPS)
  • Python/Django Implementation: Set SESSION_COOKIE_SECURE = True in settings.py, set SESSION_COOKIE_HTTPONLY = True, set SESSION_COOKIE_SAMESITE = 'Lax', for custom cookies: response.set_cookie('name', 'value', secure=True, httponly=True, samesite='Lax')
  • Java/Spring Implementation: In application.properties: server.servlet.session.cookie.secure=true, server.servlet.session.cookie.http-only=true, server.servlet.session.cookie.same-site=lax, or programmatically: Cookie cookie = new Cookie('name', 'value'); cookie.setSecure(true); cookie.setHttpOnly(true)
  • ASP.NET Implementation: In web.config: <httpCookies httpOnlyCookies='true' requireSSL='true' sameSite='Lax' />, or programmatically: HttpCookie cookie = new HttpCookie('name', 'value'); cookie.Secure = true; cookie.HttpOnly = true
  • nginx Proxy: Add headers for proxied applications: proxy_cookie_path / '/; Secure; HttpOnly; SameSite=Lax', useful when applications don't set flags correctly, overwrites cookie attributes in proxied responses
  • Apache .htaccess: Use Header edit to modify Set-Cookie headers: Header edit Set-Cookie ^(.*)$ $1;Secure;HttpOnly;SameSite=Lax, applies to all cookies set by application, useful for legacy applications that can't be modified
  • Testing After Implementation: Clear browser cookies before testing to force new cookies, check browser DevTools → Application → Cookies tab, verify Secure and HttpOnly checkboxes are ticked, check HTTP headers in Network tab for Set-Cookie values, run our Cookie Security Checker to verify all attributes present, test in multiple browsers as handling differs slightly

Pro Tip

When implementing cookie security, start with the most critical cookies first - session cookies and authentication tokens should always have Secure and HttpOnly flags as they're the prime targets for attacks. Use SameSite=Lax as the default for most cookies providing good CSRF protection without breaking functionality - only use SameSite=Strict for high-value operations like financial transactions where you can tolerate the extra friction of users needing to navigate directly rather than clicking links. Be careful with SameSite=None as it requires the Secure flag and explicitly opts into the less secure third-party cookie behavior - only use it when you genuinely need cross-site cookie functionality like embedded widgets, OAuth flows, or payment gateways. Test cookie changes in staging first as overly restrictive settings can break legitimate functionality like social media login buttons, third-party analytics, or embedded content. When debugging cookie issues use browser DevTools Network tab to see actual Set-Cookie headers rather than just checking Application→Cookies which may not show all attributes. Remember that HttpOnly cookies can't be read by JavaScript but ARE still sent in requests - they're not invisible to the server, just protected from client-side scripts. For maximum security combine all three flags: Secure, HttpOnly, and SameSite=Lax on session cookies. Set appropriate expiration times - session cookies (no Expires/Max-Age) are deleted when browser closes providing better security, but persistent cookies (with expiration) improve user experience by keeping users logged in - balance security and convenience based on sensitivity of data. Document your cookie security policy and ensure all developers understand which attributes to use on which cookie types. Run our Cookie Security Checker regularly (monthly recommended) as new cookies can be introduced through dependencies, third-party scripts, or new features. Pay special attention to cookies set by third-party scripts (analytics, advertising, social widgets) as you may have limited control over their security - consider removing third-parties that set insecure cookies. If you must support very old browsers that don't recognize SameSite, still include it as modern browsers will use it while old browsers simply ignore it. Use short-lived cookies where possible - even if stolen, a cookie that expires in 1 hour is less valuable than one that lasts 1 year. Consider implementing additional security like rotating session IDs periodically, binding sessions to IP address (with care for mobile users), and implementing proper logout that invalidates cookies server-side not just client-side.

FAQ

Is this Cookie Security Checker free?
Yes! Our Cookie Security Checker is completely free with unlimited scans, no registration required, and no hidden costs. Analyze cookies on as many websites as you need for security audits and GDPR compliance.
What's the most important cookie security flag?
The Secure flag is most fundamental as it prevents cookies from being sent over unencrypted HTTP connections. However, HttpOnly is equally critical for session cookies to prevent XSS theft, and SameSite prevents CSRF attacks. All three should be used together for comprehensive protection.
Do I need Secure flag if my site uses HTTPS?
Yes! Even with HTTPS, the Secure flag is essential because it prevents downgrade attacks where an attacker forces HTTP connection to steal cookies. It also prevents cookies from leaking if user accidentally visits HTTP version of your site. Always use Secure flag on HTTPS sites.
What does HttpOnly actually prevent?
HttpOnly prevents JavaScript from reading cookies via document.cookie, which stops XSS attacks from stealing session cookies. Even if an attacker injects malicious JavaScript into your site, they can't access HttpOnly cookies. The cookies are still sent in HTTP requests normally.
Which SameSite value should I use?
Use SameSite=Lax for most cookies - it prevents CSRF while allowing links from other sites to work. Use SameSite=Strict only for high-security operations where you can tolerate broken cross-site links. Use SameSite=None only when you truly need cross-site cookies (requires Secure flag).
Can missing cookie security flags cause GDPR violations?
Yes! GDPR Article 32 requires appropriate technical security measures for personal data. Cookies without Secure/HttpOnly/SameSite flags fail to meet reasonable security standards. Data breaches resulting from stolen cookies due to missing flags can result in major GDPR fines.
Will adding security flags break my website?
Generally no, but test first. Secure flag only works on HTTPS sites (if you're still HTTP it will break cookies). HttpOnly may break if you have JavaScript reading cookies that should be server-side only. SameSite=Strict might break legitimate cross-site functionality - start with Lax.
How do I add security flags to cookies?
Depends on your technology: PHP use setcookie() options array, Node/Express use cookie options, Django set SESSION_COOKIE_SECURE/HTTPONLY, ASP.NET set httpCookies in web.config. See 'How to Fix' section for detailed code examples for each platform.
Why do some cookies not have HttpOnly?
Some cookies legitimately need JavaScript access (like analytics cookies that JavaScript reads). However, session cookies and authentication tokens should ALWAYS have HttpOnly. Many sites incorrectly omit HttpOnly on sensitive cookies, creating security vulnerabilities.
What happens if I use SameSite=None without Secure?
Modern browsers (Chrome 80+, Firefox 69+, Safari 13+) will reject cookies with SameSite=None that don't also have Secure flag. The cookie will be ignored and not set. This is intentional security policy to prevent insecure cross-site cookies.
Can third-party cookies be secure?
Yes, if properly configured with Secure, HttpOnly (where appropriate), and SameSite=None with Secure flag. However, browsers are phasing out third-party cookies entirely for privacy reasons. Chrome plans to block all third-party cookies by 2024-2025 regardless of security flags.
Should I check cookie security regularly?
Yes! Check after deploying new code, adding third-party scripts, or framework updates that might change cookie handling. Monthly security audits should include cookie security checks. New vulnerabilities and browser requirements emerge regularly requiring ongoing monitoring.

Related tools

Pro tip: pair this tool with Security Header Strength Checker and Exposed Admin Path Detector for a faster SEO workflow.