CSP & Security Headers Builder
Build a Content-Security-Policy interactively. Get a real-time security grade, detect misconfigs, and export for HTTP headers, Nginx, or Apache.
CSP & Security Headers FAQs
A Content Security Policy is an HTTP response header that allows web servers to control which resources (scripts, styles, images, fonts, etc.) a browser is allowed to load on a page. It is one of the most powerful defenses against Cross-Site Scripting (XSS) and data injection attacks.
The unsafe-inline directive allows execution of inline scripts and inline styles, which completely defeats CSP's primary defense against XSS. An attacker can inject malicious inline code that the browser will execute freely. This tool warns you with a security grade deduction when it detects unsafe-inline in your policy.
HTTP Strict Transport Security (HSTS) is a header that tells browsers to only communicate with your site over HTTPS, never plain HTTP. Once a browser sees this header, it will refuse to make insecure connections for the specified max-age duration, preventing downgrade attacks and cookie hijacking.
Yes. Switch the output tab to Nginx or Apache to get a ready-to-paste server configuration block with all selected security headers applied. The HTTP tab generates headers as key: value pairs, and the Meta tab generates HTML meta http-equiv equivalents for static sites.
X-Frame-Options prevents your site from being embedded in an iframe on another domain, which defends against Clickjacking attacks. DENY prevents all framing, SAMEORIGIN allows framing only from the same domain. The modern equivalent is the frame-ancestors CSP directive.