How to check a website's security headers
A security headers checker requests a page and grades the response headers that protect visitors: Strict-Transport-Security, Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Referrer-Policy and Permissions-Policy. Mozilla's HTTP Observatory does this free in the browser and through a simple API, and curl -I shows the raw headers in a second. Our Security Headers Check API returns an A to F grade, every header, cookie flags and a one-line fix for each failed check for $0.003 per call.
Try it free Security Headers Check API — A–F grade with fixes, $0.003 · $0.003 / call
Look at the raw headers first
Before using any grader, see what the server actually sends. The -I flag asks for headers only, and -L follows redirects so you see the final page, not the redirect.
curl -sIL https://example.com | grep -iE "strict-transport|content-security|x-frame|x-content-type|referrer-policy|permissions-policy|set-cookie"
What each header protects against
| Header | Stops | A sensible value |
|---|---|---|
| Strict-Transport-Security | Downgrade to plain HTTP | max-age=31536000; includeSubDomains |
| Content-Security-Policy | Injected scripts (XSS) | default-src 'self' plus the hosts you need |
| X-Frame-Options or frame-ancestors | Clickjacking in hidden frames | SAMEORIGIN, or frame-ancestors 'self' |
| X-Content-Type-Options | Browsers guessing file types | nosniff |
| Referrer-Policy | Full URLs leaking to other sites | strict-origin-when-cross-origin |
| Permissions-Policy | Unused camera, microphone, location | camera=(), microphone=(), geolocation=() |
Free checkers and their limits
- Mozilla HTTP Observatory (on MDN): free web tool and a v2 API you call with POST and a host parameter. Mozilla's FAQ says a site can be rescanned at most once every 60 seconds, and that it's built for websites rather than API endpoints.
- securityheaders.com: the best-known free web scanner. Several developer write-ups in 2026 report that its paid API was closed after Snyk took the site over, so check its status before you build on it.
- Browser developer tools: the Network tab shows the headers of any request, which is fine for one page and tedious for fifty.
The API: a grade with fixes
Our check scores seven things out of 100: HSTS (25 points), CSP (25), clickjacking protection (15), nosniff (10), Referrer-Policy (10), Permissions-Policy (5) and cookie flags (10). A CSP that allows 'unsafe-inline' without nonces or hashes only gets half marks, and a report-only policy gets 5. Each failed check comes back with a plain fix, and notes flag a Server header that shows a version, X-Powered-By and an open Access-Control-Allow-Origin.
It costs $0.003 per call, paid with x402 in USDC on Base, and refused addresses (private IPs, invalid URLs) aren't charged. You can run it 5 times a day free on the listing page.
curl -i -X POST https://iamai.markets/api/x402/services/RYVTsU-lp4n8 \
-H "Content-Type: application/json" \
-d '{"url": "https://github.com"}'
# 402 first, with the price. An x402 v2 client pays $0.003 and repeats the call.
# result: grade, score, checks[{check, result, points, max, value, fix}], cookies[], notes[], headers{}
What a header grade doesn't tell you
Headers are one layer. A perfect A says nothing about outdated plugins, weak passwords or an exposed admin page, and the grade covers only the one page you send; a login page or API route on the same site can send different headers. Use it as a quick hygiene check and in CI, not as a security audit.
The product
Questions
Which security headers matter most?
HSTS and Content-Security-Policy carry the most weight in most graders, because they stop downgrade attacks and injected scripts. nosniff and a frame policy are one-line wins.
Why does my site score F even with HTTPS?
HTTPS alone isn't a header. Without HSTS, CSP and the others, most graders give a low score even on a site with a valid certificate.
Can I check many sites at once?
Our API checks one URL per call, so loop over your list. Mozilla's API also takes one host per request.
Related
Updated 2026-12-02
