CSP Analyzer

Paste a Content-Security-Policy header or meta tag to find unsafe-inline and unsafe-eval, wildcards, risky schemes, JSONP-able CDN hosts and missing directives, with a grade.

Use the tool

Why this tool exists

Many sites ship a CSP that looks serious but blocks very little. An allowed unsafe-inline, a wildcard, an allowed data: scheme or a whole CDN such as cdnjs can let an attacker run script anyway. A missing object-src or base-uri leaves further gaps.

This analyser parses the policy, notes typos and duplicate directives and reports each weakness with a severity and a suggested fix. It understands that unsafe-inline is ignored by modern browsers when a nonce, hash or strict-dynamic is present. It then gives a score from 0 to 100 and a letter grade. The check is static and based on rules of thumb, so use it as a review aid, then test the policy in a real browser. Nothing is uploaded.

How to use it

  1. Copy your Content-Security-Policy header or meta tag.
  2. Paste it into the input box.
  3. Run the tool to see the grade and the list of findings.
  4. Apply the suggested fixes and test the policy in Report-Only mode.

Frequently asked questions

How is the grade calculated?

Each finding subtracts points by severity: high 30, medium 12 and low 4, starting from 100. The score maps to a letter from A to F. It is a quick signal, not a formal audit.

Why is a CDN host flagged?

Some public hosts serve JSONP endpoints or user-uploaded scripts that can be used to bypass a host allowlist. Nonces with strict-dynamic are the usual safer approach.

Can it read a Report-Only policy?

Yes. It detects the Report-Only name, analyses the directives as usual and adds a note that the policy does not block anything yet.

Is my policy sent anywhere?

No. The analysis runs entirely in your browser, and your policy is not uploaded or stored, so you can check policies from private or staging sites.