All Tools

Content-Security-Policy (CSP) Header Builder & EvaluatorCSP Level 3 + OWASP

Construct strict Content-Security-Policy headers visually and audit existing policies against XSS bypass vectors, unsafe-inline risks, and nonce rules.

Fallback & Defaults

Default fallback for all fetch directives if not explicitly defined.

Standard Keywords:Click to toggle
Configured Values:
'none'
Navigation & Injection Control

Restricts valid URLs for the document <base> element.

Standard Keywords:Click to toggle
Configured Values:
'none'
Navigation & Injection Control

Restricts URLs to which HTML <form> elements may submit data.

Standard Keywords:Click to toggle
Configured Values:
'self'
Plugins & Embeds

Restricts valid sources for <object>, <embed>, and <applet> elements.

Standard Keywords:Click to toggle
Configured Values:
'none'
JavaScript Execution & XSS Defenses

Restricts valid sources for JavaScript execution.

Standard Keywords:Click to toggle
Popular Providers & Origins:
Configured Values:
'nonce-r4nd0mStr1ng''strict-dynamic'https:'unsafe-inline'
JavaScript Execution & XSS Defenses

Applies specifically to <script> tags rather than event handlers.

JavaScript Execution & XSS Defenses

Applies specifically to inline event handlers (e.g. onclick, onload).

Stylesheets & CSS Injection

Restricts valid sources for stylesheets and inline styles.

Standard Keywords:Click to toggle
Popular Providers & Origins:
Configured Values:
'self''unsafe-inline'
Stylesheets & CSS Injection

Applies specifically to <style> and <link rel="stylesheet"> elements.

Stylesheets & CSS Injection

Applies specifically to inline style="" attributes.

Images & Media Assets

Restricts valid sources of images and favicons.

Standard Keywords:Click to toggle
Popular Providers & Origins:
Configured Values:
'self'https:data:
Images & Media Assets

Restricts valid sources for web fonts loaded via @font-face.

Standard Keywords:Click to toggle
Popular Providers & Origins:
Configured Values:
'self'data:
Images & Media Assets

Restricts valid sources for <audio>, <video>, and <track> elements.

Network & API Endpoints

Restricts endpoints for fetch(), XMLHttpRequest, WebSocket, and EventSource.

Standard Keywords:Click to toggle
Popular Providers & Origins:
Configured Values:
'self'
Network & API Endpoints

Restricts valid sources for Worker, SharedWorker, and ServiceWorker scripts.

Network & API Endpoints

Restricts valid sources for Web App Manifests.

Framing & Embedded Windows

Restricts valid URLs for <frame> and <iframe> elements embedded in this page.

Framing & Embedded Windows

Restricts which parents can embed this page in a frame or iframe.

Standard Keywords:Click to toggle
Configured Values:
'none'
Security Flags & ReportingBoolean Flag

Directs user agents to treat all HTTP URLs as HTTPS.

Security Flags & ReportingBoolean Flag

Prevents loading any HTTP content over HTTPS (Deprecated in modern browsers).

Security Flags & Reporting

Specifies a URI where violation reports are sent (POST JSON).

Security Flags & Reporting

Specifies a reporting endpoint group name defined in the Reporting-Endpoints header.

Compiled CSP Header

Enforcing
Header: Content-Security-Policy
Security Health Forecast:Grade F (72/100)

Switch to the Security Evaluator tab to inspect full XSS injection vectors, base-tag hijacking checks, and remediation guidance.

Google Recommended Strict CSP

  • Always set object-src 'none' to prevent plugin-based script execution.
  • Always set base-uri 'none' or 'self' to block relative script hijacking.
  • Avoid domain whitelists for scripts; prefer 'nonce-...' 'strict-dynamic'.
  • Never add 'unsafe-inline' without an accompanying nonce or hash.

Understanding Content-Security-Policy (CSP) Architecture

XSS Vector Neutralization

CSP restricts the sources from which executable scripts can be retrieved or run. By requiring cryptographic nonces or hashes and prohibiting 'unsafe-inline', stored and reflected XSS payloads cannot execute.

Base-Tag Hijacking Protection

Setting base-uri 'none' prevents attackers from injecting <base href="https://attacker.com"> tags, which would hijack all relative script imports and assets to malicious origins.

Clickjacking Defense

The frame-ancestors directive supersedes legacy X-Frame-Options headers, allowing fine-grained control over which parent origins may frame your site in an <iframe>.

Technical Reference & Architecture Guide

Csp Policy Builder — Reference Guide

Interactive client-side Csp Policy Builder utility with instant in-browser processing and zero server uploads.

Key Parameters & Controls

CategoryInput Control

Configures category for Csp Policy Builder in local browser memory.

Default: Sample preset
Content-Security-Policy Header TextOption Control

Adjusts content-security-policy header text behavior during client-side csp-policy-builder execution.

Default: Default
Generated Secret NonceResult Export

Displays and copies the formatted generated secret nonce directly from client state.

Default: UTF-8

Pro Tips & Best Practices

Use Sample Presets in Csp Policy Builder

Load the built-in sample in Csp Policy Builder to inspect expected syntax and parameter defaults before pasting production payloads.

100% Offline Sandbox Execution

All Csp Policy Builder operations run inside your browser's JavaScript runtime without network requests, making it safe for sensitive tokens and internal configs.

Common Gotchas & Troubleshooting

Unexpected syntax or validation warning in Csp Policy Builder

Verify that the input passed to Csp Policy Builder contains valid UTF-8 characters and matches the selected mode.

Large payload responsiveness

For multi-megabyte inputs in Csp Policy Builder, disable live keystroke preview if available or process in chunks.

Frequently Asked Questions

Does Csp Policy Builder upload my input data to any external server?▼

No. Csp Policy Builder executes 100% locally inside your web browser using client-side JavaScript and Web APIs. Zero data leaves your device.

How does Csp Policy Builder handle invalid or malformed input?▼

Csp Policy Builder validates input syntax in real time and surfaces descriptive inline error messages without crashing or losing your current buffer.

Can I use Csp Policy Builder output directly in production workflows?▼

Yes. The output generated by Csp Policy Builder strictly adheres to standard specifications and can be copied or downloaded with one click.

Related Tools & Utilities

All Tools →