CSP Generator
Generate Content-Security-Policy HTTP headers, visually configure script-src/style-src policies, prevent XSS
Configure a Content-Security-Policy HTTP response header. Leave a field empty to omit that directive from the generated policy.
π Result Chart
Basic / Secure
Strict Mode
CDN Friendly
API Service
What is CSP Generator?
CSP Generator is a free online tool that runs entirely in your browser. No download or signup needed β set default-src, script-src and other directives to build a Content-Security-Policy header that helps prevent XSS and injection attacks. All data is processed locally.
Use Cases
- Harden your website against XSS and injection attacks
- Generate a CSP meta tag for static and client-side apps
- Quickly scaffold a security header for Nginx, Apache or CDN configs
- Compare strict, CDN-friendly and API-oriented policy templates
Key Features
- Completely Free: No registration, no limits
- Privacy Safe: Data never leaves your browser
- Cross-Platform: Any modern browser
- Zero Dependencies: Open and use