Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Check a Content-Security-Policy in your browser with this free CSP validator. Paste a header, load a sample, and review directive findings, a score, and hardening notes without uploading the policy.
Header value, full line, or meta tag.
CSP 3 nonce and strict-dynamic rules.
Validate CSP
Click Validate CSP.
A CSP validator is a browser tool that parses a Content-Security-Policy and reports syntax problems, missing directives, and sources that weaken XSS defense. You paste the header value, or a meta http-equiv tag, click Validate, and read a score with findings. The checks follow Content Security Policy Level 3 from W3C.
TestMu AI maintains this CSP validator for testers who review headers before a release. All processing happens in your browser. No data is uploaded. Pair the report with the HTTP Status Code Checker when you need to confirm the live response still sends the header you reviewed.
A header that looks complete can still fail as XSS mitigation. Validation walks each directive the way a browser will apply it, so you see wildcards, missing fallbacks, and ignored keywords before users do.
The widget stays on this page. Paste a policy, pick the CSP version you care about, and read the score beside the findings table.
The checker is built for header review during pull requests and release checks. It covers the same review points teams already walk by hand.
Testers, appsec reviewers, and frontend teams use a CSP checker when a header change is about to ship. These are the jobs that show up most often.
After the header looks sound, load the page on the Real Device Cloud and watch the console on 10,000+ real devices and 3000+ browsers. Track leftover violations in Test Manager the same way you track other release checks.
Both headers use the same directive language. The difference is whether the browser blocks a violation or only reports it. The OWASP CSP cheat sheet recommends Report-Only while you tune a new policy.
| Content-Security-Policy | Content-Security-Policy-Report-Only |
|---|---|
| Enforces the policy and blocks violating requests. | Logs violations and still loads the blocked resource. |
| Use when the allowlist is known to match the page. | Use while you collect reports and fix false positives. |
| A bad directive can break scripts, styles, or frames. | A bad directive stays visible in reports without taking the page down. |
A Content-Security-Policy header tells the browser which scripts, styles, images, and other resources a page may load. The browser blocks anything outside that allowlist, which limits XSS even if markup is compromised. Content Security Policy Level 3 defines the header syntax and the fetch, document, navigation, and reporting directives.
The unsafe-inline keyword lets any inline script or event handler run. An injected script tag then executes because the browser cannot tell your inline code from an attacker payload. A nonce or hash allowlist keeps specific inline scripts and blocks the rest. The OWASP CSP cheat sheet treats unsafe-inline as a last resort.
Every policy should set script-src or default-src, set object-src to none, and set base-uri to none or self. Add frame-ancestors to block unexpected embedding and form-action to limit form targets. A nonce or hash on script-src, plus strict-dynamic when trusted scripts load more scripts, is the current hardening path.
Yes. Paste a draft header, a Report-Only header, or a meta tag before you ship it. The validator checks syntax and unsafe sources without talking to your server. Teams often run Report-Only in production first, collect violations, then switch to the enforcing header once the report stream is clean.
No. All processing happens in your browser. No data is uploaded. Load from URL only fetches a file you name, and that request stays in your session. You can review policies from pull requests or local configs without creating an account.
A nonce is a per-response random value placed in script-src as a nonce source and on matching script tags. The browser runs only scripts that carry that nonce. Generate a new nonce on every response and keep it at least eight characters from a base64 charset so it cannot be guessed.
The score starts at 100 and subtracts points for each finding. High issues such as missing script-src or a wildcard in script-src cost more than informational notes such as a missing report-uri. The grade is a guide for review, not a proof that the site is safe.
The strict-dynamic keyword lets a nonce or hash trusted script load additional scripts without listing every host. Host allowlists, unsafe-inline, and self are ignored for that directive in CSP 3 once strict-dynamic is present. Use it with a nonce or hash, not as a stand-alone source.
Did you find this page helpful?
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance