Content Security Policy inspector
This tool reads a Content Security Policy (CSP), the HTTP header that tells browsers which scripts, styles, images and other resources a page may load. It lays out each directive and its sources and points out common weak spots. It only parses the text you paste and does not test or certify any website.
- Runs in your browser
- Free, no account needed
- Copy or download the result
Result
The short answer
A Content Security Policy is a list of directives such as script-src, each followed by the sources the browser may load from. Reading it directive by directive shows what is allowed. Values like 'unsafe-inline' weaken protection against injected script.
Formuladirective source source; directive source ...; each directive limits where one kind of content may load from
Worked exampleThe sample policy has 6 directives, from default-src 'self' to frame-ancestors 'none'. It raises 1 warning, because script-src includes 'unsafe-inline', which allows inline code.
Example
default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.example.com; img-src 'self' data: https:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'
- Directives
- 6
- Mode
- enforced when sent as Content-Security-Policy
- Scope
- parse view only, not a security test or a guarantee
| Directive | Sources |
|---|---|
| default-src | 'self' |
| script-src | 'self' 'unsafe-inline' https://cdn.example.com |
| img-src | 'self' data: https: |
| object-src | 'none' |
| base-uri | 'self' |
| frame-ancestors | 'none' |
- script-src
- 'unsafe-inline' allows inline code, which weakens protection against injected content.
How to use the content security policy inspector
- Paste one policy into the One Content-Security-Policy or Report-Only policy box. The header name in front is optional.
- Keep the policy on a single line.
- Read the warning count, the directive table and the warnings, which update as you type.
- Press Copy result or Download.
How it works
The result leads with a warning count, then a table lists each directive with its source tokens. Unrecognized names and ignored duplicates are marked.
If a directive appears twice, the second is marked as an ignored duplicate, matching how browsers treat duplicates.
Warnings flag 'unsafe-inline' and 'unsafe-eval' in script and style directives, * and http: anywhere, https: and data: in script directives, and a missing default-src or frame-ancestors directive. If a nonce or hash is also listed, the tool notes that browsers ignore 'unsafe-inline'.
A Content-Security-Policy-Report-Only header is noted as reporting violations without enforcing them.
Line breaks and commas are rejected because they signal more than one policy. The result is a parse view only, not a security test or a guarantee that the policy is safe.
Everything runs in your browser. Your input is not uploaded or stored.
Questions and answers
Does this tell me if my site is secure?
No. It parses one policy you paste. It does not load your site, run the policy or check how it works with your pages, so treat the warnings as starting points for a review.
Why does it flag a missing frame-ancestors directive?
frame-ancestors controls which sites may show your page inside a frame. default-src does not cover it, so without it the policy places no limit on framing.
Why are commas rejected?
A comma joins separate policies in one header, and browsers apply each one separately. This tool reads one policy at a time, so split them and inspect each.
Is my policy sent anywhere?
No. Parsing runs in your browser, and the tool never contacts the site the policy belongs to.
Last updated November 1, 2026. Maintained by SnowRock. How our tools work
All 220 SnowRock tools