Content Security Policy Builder

Visually build HTTP Content-Security-Policy headers with live preview, explanations, and one-click copy.

Free Runs in your browser Privacy Guaranteed • Fast Execution
No ratings yet

Tool Instructions & Quick Guide

Content Security Policy Builder

Enter your input in the workspace below, adjust the options, and the result appears instantly. Runs in your browser.

Content-Security-Policy Strict
Content-Security-Policy:

Recommended Next Steps & Workflows

Tools people often use after Content Security Policy Builder

Explore all Security & Cryptography

About Content Security Policy Builder

CSP Generator helps you assemble a Content-Security-Policy header. You turn directives on and off (default-src, script-src, style-src, img-src, font-src, connect-src, frame-src, object-src, media-src, form-action and others), choose their allowed sources, and watch the finished header update. A badge shows how strict the policy is.

You can copy the header or export ready-made snippets for Nginx, Apache and Cloudflare. It runs in your browser.

How to use Content Security Policy Builder

  1. 1

    Turn on the directives you need

    Start with default-src 'self' and add the others only where you load resources from other places.

  2. 2

    Choose sources

    Add the hosts you trust, such as your CDN or analytics domain.

  3. 3

    Copy or export

    Click Copy Header, or open Export for Nginx, Apache and Cloudflare snippets.

Example

A policy with default-src 'self' and img-src 'self' https: allows scripts and styles only from your own site and lets images load from any HTTPS address.

Good to know

Test a new policy in report-only mode first, so that you can see what it would block without breaking the site.
Avoid 'unsafe-inline' and 'unsafe-eval' where you can. They weaken the protection that CSP gives against injected scripts.
The tool builds a policy from your choices. It cannot tell which scripts your pages need, so test the result in your browser console.

Where it runs & limits

Where it runs Runs in your browser
Your data This tool runs entirely in your browser. Your input is not uploaded to ProIT.
Limits No file upload needed; works on the values you enter.
Price Free, no account needed

Maintained by QUICKGRABBER LLC · Page updated 2026-11-12 How we handle files

Questions about Content Security Policy Builder

Will a CSP stop all XSS?

It greatly reduces the impact of injected scripts when written strictly, but it is a defence in depth and does not replace escaping input.

How do I test it safely?

Deploy it as Content-Security-Policy-Report-Only first and watch the console or reports for violations before enforcing it.

Does it work with Nginx and Apache?

Yes. The export panel gives snippets for Nginx, Apache and Cloudflare.

Guides and tutorials

All guides

HTTP Security Headers and Content-Security-Policy for Beginners

What HSTS, CSP, X-Frame-Options and the other security headers do, how to roll them out without breaking your site, and how to check them. · 5 min read

Cryptography 101: Cryptographic Hashes, Password Entropy & Digital Signatures

Learn the fundamentals of modern cryptography: how SHA-256 and MD5 checksums work, how to calculate password entropy, and how to verify API signatures with HMAC. · 5 min read

How to Create Strong Passwords You Can Actually Manage

What makes a password strong, why length beats complexity rules, how password managers and two-factor authentication help, and a plan to secure accounts. · 5 min read