This page has no affiliate links. If we add any later, they will be marked and will never change our rankings. How we make money

Website security headers explained

Last reviewed: 8 November 2026

Security headers are short instructions your web server sends with every page. They tell the browser to block some common attacks. Run our free website security check to see which ones your site sends.

The headers that matter

HeaderWhat it doesSafe starting valueReference
Strict-Transport-SecurityMakes browsers use HTTPS onlymax-age=31536000; includeSubDomainsMDN
Content-Security-PolicyLimits where scripts and other content may load fromStart with Content-Security-Policy-Report-OnlyMDN
X-Content-Type-OptionsStops browsers guessing file typesnosniffMDN
CSP frame-ancestors (or X-Frame-Options)Blocks clickjackingframe-ancestors 'self'MDN
Referrer-PolicyLimits URL details sent to other sitesstrict-origin-when-cross-originMDN
Permissions-PolicyTurns off browser features you do not usecamera=(), microphone=(), geolocation=()MDN

How to add them

Common mistakes

Headers are one layer. A web application firewall and up-to-date software matter more.

FAQ

Which security header should I add first?

Strict-Transport-Security (once every page works on HTTPS) and X-Content-Type-Options: nosniff are the simplest wins.

Can security headers break my site?

Content-Security-Policy can, if it blocks scripts your site needs. Use report-only mode first. The other headers rarely cause problems.

Sources

Related