Content-Security-Policy (CSP) Header Builder

Assemble a clean Content-Security-Policy HTTP header for scripts, styles, images, fonts, frames, and upgrade-insecure-requests.

Inputs

Compose a clean, strict CSP header tailored to your analytics and image hosts.

Generated csp-header.txt

Ready to copy or download. Runs 100% in your browser.

Content-Security-Policy: default-src 'self'; script-src 'self' https://www.googletagmanager.com https://va.vercel-scripts.com; style-src 'self' 'unsafe-inline'; img-src 'self' https: data: blob:; font-src 'self' data:; connect-src 'self' https://www.google-analytics.com; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests
  • Test first with Content-Security-Policy-Report-Only before enforcing.

Common questions

Why start with Content-Security-Policy-Report-Only?

Report-Only logs violations in the browser console without blocking assets while you verify every third-party host.

What does frame-ancestors 'none' do?

It stops other websites from embedding your pages inside hidden iframes for clickjacking attacks.