CSP Evaluator
Paste a Content-Security-Policy and get a severity-ranked audit — XSS bypasses in script-src, missing object-src, base-uri and frame-ancestors, unsafe-inline, risky CDNs, typos and deprecated directives — each with a concrete fix. Runs in your browser.
Input
Paste the policy value. A leading "Content-Security-Policy:" header name is stripped automatically.
A <meta> policy ignores frame-ancestors, sandbox and report-uri.
Output
| Metric | Value |
|---|---|
| No data yet | |
| Severity | Directive | Finding | How to fix |
|---|---|---|---|
| No data yet | |||
| Directive | Sources | Issues |
|---|---|---|
| No data yet | ||
More ways to use this tool
REST API
curl -X POST https://api.iotools.cloud/v1/tool/csp-evaluator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"policy": "default-src 'self'; script-src 'self' 'unsafe-in…",
"delivery": "header"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `csp-evaluator` tool (CSP Evaluator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.
Embed widget
<iframe
src="https://iotools.cloud/embed/csp-evaluator/"
width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
title="CSP Evaluator — iotools.cloud"
sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
allow="clipboard-write"
style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>Drop this into your own page — free, no key required, just a link back.
| Cost per API/MCP call | From 5 credits |
|---|---|
| Need more credits? | View pricing |
Also available with
Guides
What the CSP Evaluator checks
A Content-Security-Policy can look strict and still leave cross-site scripting wide open. One 'unsafe-inline', an https: scheme in script-src or a missing object-src is enough. Paste a policy and this evaluator audits it directive by directive. Each finding gets a severity (High, Medium, Low or Info) and a concrete fix, and the policy gets an overall rating.
Checks include:
- Script execution:
'unsafe-inline','unsafe-eval'and'unsafe-hashes',*,https:,data:andblob:sources, scripts loaded over plainhttp://, and wildcard subdomains. - Known bypass hosts: CDNs and Google endpoints that serve JSONP or old AngularJS builds, which attackers use to run script without leaving your allowlist.
- Nonces and
'strict-dynamic': short nonces, and'strict-dynamic'with no nonce or hash (which blocks every script). It also knows that a nonce makes modern browsers ignore'unsafe-inline'and host sources, so a backward-compatible strict policy isn't flagged for its fallbacks. - Missing directives that don't fall back to
default-src:base-uri,form-actionandframe-ancestors, plus a missingobject-srcanddefault-src. - Mistakes: duplicate directives (browsers ignore every copy after the first), unknown directives with a "did you mean" suggestion (
scirpt-src→script-src), commas used as separators, and deprecated directives such asblock-all-mixed-content,plugin-typesandreferrer.
How to use it
- Paste the policy value. If you copied the whole header line, the
Content-Security-Policy:prefix is stripped for you. - Pick how the policy is delivered. A policy in a
<meta http-equiv>tag ignoresframe-ancestors,sandboxandreport-uri, so the evaluator flags those instead of counting them as protection. - Read the findings from the top. High findings are real XSS exposure. Medium findings weaken the policy. Low and Info findings are hardening suggestions.
The Directives table lists every directive with its sources and how many issues point at it, which helps when you're working through a long policy.
What does a strong policy look like?
The pattern that holds up best is a nonce-based "strict CSP":
script-src 'nonce-{random}' 'strict-dynamic' https: 'unsafe-inline'; object-src 'none'; base-uri 'none'Modern browsers trust only scripts that carry the nonce (and scripts those load). Older browsers fall back to https: and 'unsafe-inline'. Generate a fresh random nonce for every response. A fixed nonce gives no protection.
Is a warning always a problem?
No. The evaluator reads the policy, not your site. 'self' is safe if your origin hosts no JSONP endpoints or user uploads, and style-src 'unsafe-inline' is a common, low-risk trade-off. Treat Low and Info findings as a review checklist, then roll the policy out as Content-Security-Policy-Report-Only first and watch for real violations.
Privacy
The policy is evaluated entirely in your browser and never sent to a server.
Related tools
To build a policy from scratch, use the CSP Generator. To check whether a specific script, image or inline block would be allowed by a policy, use the CSP Resource Evaluator. To see which headers a live site actually sends, use the HTTP Header Checker.