CSP Header Generator – Free Online Tool
Build Content-Security-Policy headers visually. Select directives and sources, then copy the header or meta tag.
Runs in your browser. Nothing you type or paste is uploaded, saved, or sent to an AI.
default-srcFallback for all resource types
script-srcJavaScript sources
style-srcCSS sources
img-srcImage sources
font-srcFont sources
connect-srcXHR, WebSocket, fetch origins
media-srcAudio/video sources
frame-srciframe sources
object-srcPlugin sources
base-uriRestrict <base> element
form-actionForm submit targets
frame-ancestorsWho can embed this page
Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; object-src 'none'
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; object-src 'none'">
How to Use CSP Header Generator
- 1
Select Directives
Toggle source values for each CSP directive.
- 2
Review Policy
See the complete CSP header and meta tag.
- 3
Copy
Copy the HTTP header or HTML meta tag.
Common Use Cases
- ✦Securing web applications
- ✦Preventing XSS attacks
- ✦Configuring security headers
Share
Share a link to this tool. Results can be passed via URL parameters.
https://buildutilities.com/share/csp-header-generatorFrequently Asked Questions
More Security Tools
Security-focused tools for passwords, tokens, and cryptography.
💪 Password Strength Checker🪙 JWT DecoderH# HMAC Generator🔐 SSH Key Fingerprint🔒 Bcrypt Hash Generator🔒 Secret Redactor
View all Security tools