About this tool
Subresource Integrity (SRI) lets browsers verify that third-party scripts and stylesheets fetched from a CDN have not been tampered with. You publish a cryptographic hash in the integrity attribute of <script> or <link>, and the browser refuses to execute the file if the downloaded bytes do not match.
This tool computes SHA-256, SHA-384 and SHA-512 SRI hashes locally using the Web Crypto API from pasted code or a local file, builds ready-to-copy <script> or <link> tags with crossorigin="anonymous", and lets you verify an existing integrity string offline.
Security tips
- SHA-384 is the standard recommended algorithm for SRI hashes because it balances strong collision resistance with concise headers.
- Always include crossorigin="anonymous" on external CDN tags so browsers can perform CORS-enabled integrity checks.
- Combine SRI with a strict Content-Security-Policy (CSP) for defence in depth against supply-chain and XSS attacks.
Frequently asked questions
Why does SRI require crossorigin="anonymous"?
When loading a script or stylesheet from another origin, browsers need CORS headers (such as Access-Control-Allow-Origin: *) to inspect the response body and verify the SRI hash without leaking cross-origin data.
What happens if an integrity attribute lists multiple hashes?
Per the W3C SRI specification, browsers pick the strongest supported hash algorithm in the list (SHA-512 > SHA-384 > SHA-256) and allow the resource if at least one hash of that algorithm matches.
Does this tool download the URL I enter?
No. The URL field is used strictly to format your local HTML snippet. All hashing happens offline on the text or local file you provide.
Related guides
Related tools
CSP Analyzer & Builder
Audit Content-Security-Policy headers for XSS and clickjacking risks, or build strict policies for Cloudflare and Nginx.
HTTP Security Headers Checker
Scan a website's HTTP response headers for HSTS, CSP, clickjacking, referrer and cookie protections, and get a grade.
Hash Generator
Calculate SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text or files.