Content-Security-Policy Builder
Build a Content-Security-Policy header by adding directives (default-src, script-src, img-src, frame-ancestors) with predefined sources.
Selecione fontes para cada diretiva. Adicione hosts customizados separados por espaço ou linha.
Build a Content-Security-Policy header
Few defences stop a script-injection (XSS) attack as well as the Content-Security-Policy. The catch is the syntax: so many directives and sources that it intimidates at a glance. Here the builder handles the tedious part for you, adding each directive in a guided way. No CSP grammar to memorise.
You compose the rules for directives such as default-src, script-src, img-src and frame-ancestors from common, predefined sources. The tool merges it all into a valid header. With that you can limit where the browser loads resources from, and the site's attack surface shrinks considerably.
The whole build happens in your own browser, in real time, with nothing leaving it. Handy for developers who want to harden their pages without getting tangled in CSP syntax.
Frequently asked questions
Which directives and sources can I configure?
Does the Copy button grab the whole header or just the value?
Does the tool warn me when the policy turns out invalid or weak?
Related Tools
Basic CSP Evaluator
Evaluates a Content-Security-Policy directive reporting unsafe-inline, unsafe-eval or wildcard issues.
Trusted Types Policy Builder
Generate CSP require-trusted-types-for and trusted-types directives with policy names — a modern anti-XSS mitigation.
Mixed Content Detector
Scans http:// references inside HTML served over HTTPS, flagging insecure assets and links.
COOP / COEP Headers Builder
Generate the COOP and COEP HTTP headers (Cross-Origin Opener/Embedder Policy) to isolate your origin. Required to safely use features like SharedArrayBuffer.
X-Content-Type-Options Header Check
Confirm X-Content-Type-Options is set to nosniff and explain MIME-sniffing risks when the header is missing.
Clear-Site-Data Header Builder
Build a Clear-Site-Data header (cache, cookies, storage, executionContexts) — useful on logout to wipe origin data.