Skip to content
toolstome

Content Security Policy (CSP) validator

Paste a Content-Security-Policy header, with or without the header name, and the validator splits it into directives, checks every source expression against CSP Level 3, and lists problems ranked from high to low. It catches keywords without quotes, malformed nonces and hashes, misspelled and deprecated directives and duplicates that browsers ignore, and the weaknesses most often used to bypass CSP: 'unsafe-inline' and 'unsafe-eval' in scripts, wildcard, https: and data: script sources, and missing object-src, base-uri and frame-ancestors.

Free · No sign-upProcessed in your browser

Paste a Content-Security-Policy header to check it.

How to use the CSP Validator

  1. 1

    Copy the policy

    Copy the Content-Security-Policy header from your server configuration or the browser’s network panel.

  2. 2

    Paste it

    Paste it in the box. The header name is optional.

  3. 3

    Read the findings

    High findings let attackers run scripts; fix them first.

  4. 4

    Fix and retest

    Edit the policy, paste it again, or rebuild it with the CSP generator.

When to use it

  • Review a site’s CSP before a security audit or penetration test.
  • Find why a policy does not protect against cross-site scripting.
  • Check a policy copied from a tutorial before deploying it.

Limits

  • The validator checks the policy text only; it does not fetch your site or test which content is blocked.
  • Findings are heuristics based on known CSP bypasses, such as allowed hosts that serve JSONP, which it cannot detect.
  • Policies sent in several headers are combined by browsers; paste them one at a time.

Privacy

The policy is checked in your browser. Nothing you paste is sent anywhere.

Frequently asked questions

Is 'unsafe-inline' really that bad?

For scripts, yes: it allows any inline script, including one injected by an attacker, which removes most of the protection CSP gives against cross-site scripting. Use nonces or hashes instead. For styles it is a much smaller risk.

What is the difference between the header and the meta tag?

Both set a policy, but the meta tag cannot use frame-ancestors, report-uri, report-to or sandbox, and it only applies to content after it in the page. The HTTP header is preferred.

What does Report-Only do?

Content-Security-Policy-Report-Only reports violations without blocking anything, so you can test a policy on a live site before enforcing it.

What is 'strict-dynamic'?

With a nonce or hash, it lets scripts loaded by trusted scripts run too, and makes browsers ignore host allowlists. It is the basis of the strict CSP that Google recommends.

Why set object-src 'none' and base-uri?

object-src 'none' blocks old plugin content such as Flash, which can bypass script rules. base-uri stops an injected base tag from redirecting your relative script URLs.

Why are duplicate directives a problem?

Browsers use only the first occurrence of a directive and ignore later ones, so sources added in a second copy have no effect.

People also use

Last updated November 22, 2026 · How we build and test our tools

Categories

Recently used tools

Tools you open will appear here.

More