Skip to content

Ready

Enter a domain on the left and run the test. Results stream in here.

A list of what your page is allowed to load

A Content Security Policy (CSP) is a response header that tells the browser which sources of scripts, styles, images, fonts, frames and network requests a page may use. Anything not allowed is blocked. Its main job is to stop cross-site scripting: if an attacker manages to inject a script into your page, a good policy stops the browser from running it. A weak policy looks protective on paper while allowing almost everything.

This CSP header checker fetches your URL and reads the enforced Content-Security-Policy header. If there is none, it looks for a CSP meta tag in the HTML, and then for a Content-Security-Policy-Report-Only header. It splits the policy into directives, lists the sources each one allows, and flags specific weaknesses with a severity and a suggested fix.

Every finding the analyzer can raise

Critical: no policy at all; 'unsafe-inline' in script-src without a nonce or hash; 'unsafe-eval' in script-src; and a wildcard or scheme-wide script source such as *, https: or data: (unless 'strict-dynamic' is used, which makes browsers ignore those).

Warnings: the policy is report-only, so nothing is actually blocked; no default-src, so resource types without their own rule are unrestricted; no script-src or default-src at all; a * wildcard in other directives such as img-src or connect-src; and no frame-ancestors, which leaves the page open to clickjacking unless X-Frame-Options is set.

Notes: 'unsafe-inline' sitting next to nonces or hashes (modern browsers ignore it then, so it is only a fallback for very old ones); no object-src; no base-uri; frame-ancestors placed in a meta tag, where browsers ignore it; and no report-uri or report-to, which means you cannot see what the policy blocks for real visitors.

Weak versus strong, side by side

This policy exists, but it allows scripts from anywhere and inline code, so it stops almost nothing:

Content-Security-Policy: default-src *; script-src * 'unsafe-inline' 'unsafe-eval'

This one uses a fresh nonce on every page load. Only script tags carrying that nonce run, and 'strict-dynamic' lets those trusted scripts load the scripts they need without listing every domain:

Content-Security-Policy:
  default-src 'self';
  script-src 'nonce-r4nd0mPerRequest' 'strict-dynamic';
  style-src 'self' 'unsafe-inline';
  img-src 'self' data: https://images.example-cdn.com;
  connect-src 'self' https://www.google-analytics.com;
  object-src 'none';
  base-uri 'self';
  frame-ancestors 'self';
  report-to csp-endpoint

Note that style-src keeps 'unsafe-inline' here. That is a common, acceptable trade-off: inline styles are far less dangerous than inline scripts, and many sites and plugins depend on them. Focus your effort on script-src first.

Rolling out a policy without breaking the site

A strict policy written from memory will almost certainly block something you need: your analytics, tag manager, chat widget, payment form, fonts or video embeds. The safe path is report-only mode. Browsers load everything as normal but report each request your policy would have blocked. Collect those reports for a week or two across your key pages, adjust the policy, and switch to the enforcing header once the reports are quiet.

# Start in report-only mode: nothing is blocked, violations are reported
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' https://www.googletagmanager.com; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; report-uri /csp-reports" always;

Apache

Use Header always set Content-Security-Policy-Report-Only "..." in the HTTPS virtual host (mod_headers), then rename it to Content-Security-Policy when you are ready to enforce.

Cloudflare

Add the header with a Transform Rule that modifies response headers. Cloudflare's own scripts, such as bot challenges or email obfuscation, may need allowing; the reports will show them.

WordPress and Google Tag Manager

WordPress themes and plugins rely heavily on inline scripts, so a nonce-based policy usually needs a plugin or custom code that adds the nonce to every script tag. Google Tag Manager loads scripts from many domains depending on your tags; Google publishes CSP guidance for GTM, and 'strict-dynamic' with a nonce on the GTM snippet is the cleanest approach.

Shopify

Shopify does not let you set custom response headers on storefronts, so a full CSP is not something you can control there. Focus on keeping third-party apps and scripts to the ones you trust.

Header or meta tag?

A policy can also be set with a meta http-equiv tag in the page head. That works for most directives but not all: frame-ancestors, report-uri and sandbox are ignored in a meta tag. If you can set headers, use the header. If both exist, browsers apply both, and a resource must pass each policy, which makes problems hard to trace.

Security, not a ranking lever

CSP is not a Google ranking factor. Its SEO value is defensive: a cross-site scripting attack that injects spam links, redirects or malware can lead to Safe Browsing warnings and lost visibility, and CSP makes that much harder. The flip side is that a broken policy can block scripts your page needs to render, so test key templates in a browser and check that important content still appears after each change. Our article on security headers and SEO covers how CSP fits alongside the others.

Fix order once you have the report

No policy? Start with report-only. A policy with 'unsafe-inline' or 'unsafe-eval' in script-src? Move inline scripts into files or give them nonces, remove code that needs eval, and re-run the check. Then replace wildcards with the specific domains you use, and add object-src 'none', base-uri 'self' and frame-ancestors. Add a report endpoint so future breakage is visible. Re-check whenever you add a third-party tag. If http:// files on HTTPS pages are your concern rather than script control, the Mixed Content Checker covers the upgrade-insecure-requests side, and the HTTP Header Checker shows CSP next to every other security header.

How it works

  1. Enter a URL

    Paste any URL whose Content-Security-Policy you want to inspect.

  2. We parse the policy

    The tool fetches the response, reads the CSP header, and splits it into individual directives and their source lists.

  3. Review the weaknesses

    See every directive listed with unsafe-inline, unsafe-eval, missing default-src, and wildcard sources flagged with fixes.

Frequently asked

What is a Content Security Policy?

›

A response header that lists which sources of scripts, styles, images, fonts, frames and connections a page may use. The browser blocks anything not allowed. Its main purpose is to stop injected scripts from running, which limits cross-site scripting attacks.

Where does the analyzer look for my policy?

›

First the Content-Security-Policy header, then a CSP meta tag in the HTML if there is no header, then the Content-Security-Policy-Report-Only header. It warns if the policy is report-only, because report-only blocks nothing.

Why is 'unsafe-inline' in script-src a problem?

›

It allows inline scripts and event handlers, which is exactly what most injected attacks use, so it removes much of CSP's protection. Use nonces or hashes for inline scripts instead. If nonces or hashes are present, modern browsers ignore 'unsafe-inline', and the tool reports that as a note rather than a critical issue.

What is wrong with 'unsafe-eval'?

›

It lets the page turn text into running code with eval() and similar functions, which many attacks rely on. Most modern sites do not need it; if a library does, look for an alternative build or setting.

Why are wildcards like * or https: flagged in script-src?

›

They allow scripts from any site, so an attacker who can host a file anywhere can load it. Replace them with the specific domains you use, or use a nonce with 'strict-dynamic', in which case browsers ignore those broad sources.

Should I start with report-only mode?

›

Yes. Content-Security-Policy-Report-Only applies the policy without blocking anything and reports what would have been blocked. Collect reports across your key pages, adjust, then switch to the enforcing header.

Why does the tool say frame-ancestors is ignored?

›

frame-ancestors, report-uri and sandbox do not work in a CSP meta tag. If your policy is set in the HTML, send it as an HTTP header instead to control who can frame your pages.

Does CSP affect SEO?

›

It is not a ranking factor. It helps prevent hacks that inject spam or malware, which can cause security warnings and lost visibility. A policy that is too strict can block scripts your page needs to render, so check important pages still display correctly after changes.

How do I check a website's CSP header?

›

Enter the URL. The checker reads the Content-Security-Policy response header, falls back to a CSP meta tag or a Report-Only header if there is no enforced policy, and lists each directive with the sources it allows.

Related tools

More Technical SEO tools

See all Technical SEO tools · All free SEO tools

Related guides

↳ full site audit190+ checks · AI fix instructions · yearly plans