Pick a preset, toggle the sources you trust, and copy a ready-to-paste CSP header.
1. Choose a starting preset
2. Configure directives
Fallback for any directive you don't override.
Where JavaScript can load from.
Where stylesheets can load from.
Where images can load from.
Where web fonts can load from.
fetch / XHR / WebSocket / EventSource endpoints.
Where iframes can load from.
audio and video sources.
object, embed, applet sources.
Where forms can submit to.
Restricts the <base href> value.
Who is allowed to embed your site in a frame.
3. Copy your policy
'self' = your own domain. 'none' = block everything for that directive. 'unsafe-inline' weakens XSS protection — avoid if possible. The Content Security Policy Generator is an interactive tool that helps you build robust CSP headers to protect your website from XSS attacks and other security vulnerabilities. This free CSP builder provides an intuitive interface for creating custom Content Security Policy headers with ready-to-use code for Apache, Nginx, and HTML meta tag implementation.
Select the content sources you want to allow for scripts, styles, images, fonts, and other resources using the interactive interface. The tool automatically generates the corresponding Content-Security-Policy header syntax. You can choose between enforcement mode or report-only mode, and the generator provides implementation code for different server configurations and HTML meta tags.
Start with a Content-Security-Policy-Report-Only header to monitor violations without blocking content. Avoid 'unsafe-inline' and 'unsafe-eval' directives whenever possible, using nonces or hashes instead for legitimate inline scripts. Regularly review CSP violation reports to identify and fix policy issues. Test thoroughly in staging environments before deploying strict policies to production.
This CSP generator tool simplifies the complex process of creating Content Security Policies, making advanced XSS protection accessible to developers and website owners. A well-configured CSP is one of the most effective defenses against cross-site scripting attacks and unauthorized content injection.
Your report has been submitted. We will look into this issue.
Hide your real IP and encrypt your connection with NordVPN.
Themes, plugins, code, video, audio, graphics & more from 90,000+ authors.
Web Development
Design & Media
Unlimited Access
Explore Envato Market