CSP Generator
Build Content Security Policy headers visually with toggleable directives and sources.
Fallback security perimeter for unstated directives
Valid executable JavaScript origins
Valid CSS stylesheets & typography origins
Permitted image and favicon sources
Web fonts loaded via @font-face
Fetch, XMLHttpRequest, WebSocket, and Beacon endpoints
Audio and video stream origins (<audio>, <video>)
Plugins (<object>, <embed>, <applet>) - Recommend 'none'
Valid child iframe and embed destinations
Web Worker, SharedWorker, and ServiceWorker scripts
PWA web application manifest origins
Restricts URLs that can appear in a document's <base> element
Restricts valid endpoints for form submissions
Clickjacking defense: Who can embed this page via iframe
Instructs browsers to treat all HTTP URLs as HTTPS
Prevents loading any HTTP content over HTTPS
Security Risk Assessment
Cross-Site Scripting (XSS) Defense
Content Security Policy (CSP) restricts executable script origins, mitigating reflected, stored, and DOM-based XSS attacks.
Multi-Platform Server Configs
Generate ready-to-deploy code snippets for Next.js App Router, Nginx, Apache .htaccess, and Cloudflare Workers.
Live Vulnerability Audit
Inspect dangerous directives in real time, alerting you to unsafe-inline and unsafe-eval vectors before pushing to production.
Frequently Asked Questions
What is a Content Security Policy (CSP)?
How do I add the generated policy to my web application?
What is the difference between default-src and script-src?
Does this CSP Generator run client-side?
More Security & Privacy Utilities
DMARC, SPF & DKIM Email Security Auditor & Generator
Audit live DMARC, SPF, DKIM, and BIMI DNS records. Detect 10-lookup SPF limit violations, spoofing vulnerabilities, and generate copy-paste DNS records and 2048-bit DKIM keys.
TOTP / 2FA Authenticator Simulator
Simulate, generate, and verify RFC 6238 Time-based One-Time Passwords with interactive countdowns, URI import, SHA-1/256/512 algorithms, and clock drift testing.
PII & Secret Log Redactor / Masker
Scrub credentials, API keys, passwords, credit cards, emails, and PII from production logs and error stack traces 100% locally in your browser before sharing.