CSP Builder.
Build a Content-Security-Policy one directive at a time, with keywords quoted for you and risky combinations flagged. Outputs a header and a meta tag.
Input
How to fill in sources
Each directive takes a list of sources separated by spaces. No commas, no quotes around URLs.
- KeywordsBare or quoted. The tool wraps them in single quotes for you.
self, none, unsafe-inline, unsafe-eval - Same originScheme + host + port match the page.
'self' - URLsInclude the scheme. Port matters.
https://cdn.example.com - WildcardsSubdomain wildcard. * alone allows any origin (avoid).
*.example.com https://*.cdn.example.com - SchemesNote the trailing colon.
data: blob: mediastream: - NoncesAuto-quoted. Pair with a matching nonce attribute in your HTML.
nonce-AbCdEf - HashesAuto-quoted. Base64 of the script/style body.
sha256-AbCd... sha384-... sha512-... - Block allMust be the only value in the directive.
'none'
default-srcFallback for fetch directives. Example:
'self'script-srcJavaScript sources. Example:
'self' https://cdn.example.com 'nonce-abc123'style-srcStylesheets and <style>. Example:
'self' https://fonts.googleapis.comimg-srcImages. Example:
'self' data: https://images.example.comfont-src@font-face sources. Example:
'self' https://fonts.gstatic.comconnect-srcfetch / XHR / WebSocket / EventSource. Example:
'self' https://api.example.com wss://api.example.comframe-srcSources for <iframe> / <frame>. Example:
'self' https://www.youtube.comframe-ancestorsWho can frame this page (replaces X-Frame-Options). Example:
'self'
Output
Configure directives on the left.
About this tool.
Fill in source lists per directive (default-src, script-src, …) and the tool emits a ready-to-use Content-Security-Policy header and a matching <meta http-equiv> tag. Bare keywords like 'self' / 'unsafe-inline' / 'unsafe-eval' are quoted for you, as are nonce-… and sha256-… sources. The linter flags wildcards, unsafe-inline / unsafe-eval, data: in script-src, plain-http origins, and CSP3 best-practice hints like missing default-src or object-src 'none'.
Privacy.
Runs in your browserEverything happens in your browser. The composed CSP is never sent anywhere.
Disclaimer. Provided as-is, with no warranty of any kind. Always check critical results before acting on them. I accept no liability for inaccuracies, bugs, or any loss or damages arising from use of these tools.
Spotted a bug or want to suggest an improvement?Let me know
More tools.
All tools- JWT DecoderDecode a JSON Web Token's header and payload in your browser. It doesn't verify signatures or make any network calls.
- SHA Hash GeneratorCompute SHA-1, SHA-256, SHA-384 and SHA-512 digests of any text, shown as hex and base64.
- .env ComparatorSpot missing, extra or changed keys between two env files, all inside your browser.