CSP Header Generator Online Free

Build secure Content Security Policy (CSP) headers for your website. Define source permissions for scripts, stylesheets, images, fonts, frames, and other directives visually.

✓ Free security tool✓ No signup required✓ Fast results✓ Browser-based utility✓ Mobile friendly
🔒Privacy Note: This tool runs in your browser and does not upload data to BuBird servers.
Security Tools
CSP Header Generator
🛡️

CSP Header Generator

Build Content Security Policy headers for scripts, styles, images, fonts and other directives.

Directives
Generated Header
Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-src 'none'; object-src 'none'

Add this HTTP response header to your server configuration.


How to Use This Tool

1

Select Default Policy

Choose default-src parameters (e.g. 'self') to secure unmapped resource types.

2

Map Resource Sources

Add approved domains or wildcard lists for script-src, style-src, and img-src.

3

Toggle Security Directives

Enable strict parameters like upgrade-insecure-requests or block-all-mixed-content.

4

Copy Header output

Copy the generated header string to place in your web server (Nginx, Apache, IIS) configuration.

Securing a web app with Google Fonts and Analytics

You need to secure your app while allowing Google Fonts and Google Analytics scripts to run. Select 'self' as default. In script-src, add '*.google-analytics.com'. In style-src, add 'fonts.googleapis.com'. The builder outputs the correct CSP string instantly.

Common Use Cases

XSS Defense

Configure web security headers to mitigate cross-site scripting vulnerabilities.

DevOps & Deployment

Generate compliant security headers for web applications, CDNs, and proxy configurations.

Web Audits

Align with OWASP standards by applying strict Content Security Policy directives.

Academic Training

Learn key CSP directives like object-src, frame-ancestors, connect-src, and sandbox.

Related Security Tools

Frequently Asked Questions

What is Content Security Policy (CSP)?
CSP is an HTTP response header that defines which dynamic resources (such as JavaScript, CSS, images, and frames) are allowed to load and execute on a website, protecting against XSS attacks.
What does 'unsafe-inline' mean in a CSP policy?
The 'unsafe-inline' directive allows execution of inline scripts and styles. While convenient, it reduces XSS protection, so using hashes or nonces is recommended.
Does this tool upload my CSP configuration?
No. The policy generation runs locally in your browser using JavaScript and does not upload your server configuration details.