Free tool · no sign-up

Security Headers Checker

Scan any website's HTTP response headers and see which security headers are set, which are missing, and what each one protects against. You get a grade from A+ to F with the fix for each problem.

By Jamiul Alam Rejon · Updated

Quick answer

A security headers check reads the HTTP headers a website sends and looks for the ones that protect visitors: Strict-Transport-Security, Content-Security-Policy, X-Frame-Options (or frame-ancestors), X-Content-Type-Options, Referrer-Policy and Permissions-Policy. Missing headers leave the site more exposed to attacks such as cross-site scripting and clickjacking.

What each security header does

Strict-Transport-SecurityForces HTTPSStops: Downgrade & cookie theft
Content-Security-PolicyAllow-lists scripts & sourcesStops: Cross-site scripting (XSS)
X-Frame-Options / frame-ancestorsBlocks framingStops: Clickjacking
X-Content-Type-OptionsNo MIME sniffingStops: Disguised script files
Referrer-PolicyTrims the referrerStops: Leaking private URLs
Permissions-PolicySwitches off browser featuresStops: Abuse of camera, mic, location
What each security header does and the attack it helps stop.

Recommended security headers

A sensible starting point for most websites. Adjust the Content-Security-Policy to the scripts, fonts and images your site actually loads.

Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Content-Security-Policy: default-src 'self'; img-src 'self' https: data:; frame-ancestors 'none'
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
Cross-Origin-Opener-Policy: same-origin

How to add security headers

Nginx

add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-Frame-Options "SAMEORIGIN" always;

Apache or LiteSpeed (.htaccess)

<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>

Cloudflare

Go to Rules → Transform Rules → Modify Response Header, create a rule for all requests and add each header. Turn on HSTS separately under SSL/TLS → Edge Certificates.

Next.js

// next.config.js
module.exports = {
  async headers() {
    return [{
      source: "/(.*)",
      headers: [
        { key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains" },
        { key: "X-Content-Type-Options", value: "nosniff" },
        { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
        { key: "X-Frame-Options", value: "SAMEORIGIN" },
      ],
    }];
  },
};

How to read your grade

GradeWhat it usually means
A+ / AHSTS, a working CSP and the basic headers are all set.
BThe basics are in place, but CSP is missing or weak.
C / DSeveral important headers are missing; often a default hosting setup.
FAlmost nothing is set. Start with HSTS, X-Content-Type-Options and X-Frame-Options; they rarely break anything.

Things to watch out for

  • HSTS is hard to undo. Browsers remember it for the whole max-age. Make sure every subdomain works on HTTPS before you add includeSubDomains or submit to the preload list.
  • Test CSP first. Use the report-only header until nothing legitimate is blocked.
  • Remove version numbers. “Apache/2.4.41” or “PHP/7.4” in headers tells attackers exactly which known bugs to try.
  • Headers don't fix outdated software. Keep WordPress, plugins and the server itself updated.

Check the certificate too with the SSL Checker. If you'd rather hand this over, my website security service covers headers, Cloudflare, HTTPS and malware clean-up.

Frequently asked questions

What are HTTP security headers?

Instructions your server sends with every page that tell the browser how to behave: always use HTTPS, only run scripts from approved places, don't let other sites frame the page, and so on. They're one of the cheapest ways to block common attacks.

Which security headers are most important?

Strict-Transport-Security (HSTS) and Content-Security-Policy (CSP) protect against the most serious problems: connection downgrades and cross-site scripting. Then X-Frame-Options or CSP frame-ancestors against clickjacking, and X-Content-Type-Options: nosniff.

How is the grade worked out?

Each header is weighted by how much protection it adds; HSTS and CSP count the most. A+ needs a score of 95 or more, A 85, B 70, C 55 and D 40. Information leaks like a version number in the Server header lower it a little.

How do I add security headers?

On your web server (Nginx add_header, Apache Header set, or LiteSpeed's .htaccess), in your hosting or CDN dashboard (Cloudflare Transform Rules), or in your app's config, such as headers() in next.config.js.

Should I still use X-XSS-Protection?

No. Modern browsers have removed the XSS filter it controlled, and in older browsers it could be abused. Send X-XSS-Protection: 0 or leave it out, and use Content-Security-Policy instead.

Can a strict Content-Security-Policy break my site?

Yes, if it blocks scripts or styles your site needs, such as analytics or chat widgets. Start with Content-Security-Policy-Report-Only to see what would be blocked, fix it, then switch to the enforcing header.