NetSecTools

All tools / Web & Network / SRI Hash Generator & Verifier

SRI Hash Generator & Verifier

Generate SHA-256, SHA-384 and SHA-512 Subresource Integrity (SRI) hashes and HTML snippets for scripts and stylesheets offline in your browser.

Try:
Combined integrity attribute
 
Ready-to-use HTML snippet
 

Individual SRI hashes

SHA-256
 
SHA-384
 
SHA-512
 

Verify existing SRI

Not Checked Not Checked

All SRI hashes are computed locally in your browser using the Web Crypto API. Neither your code, local files nor the resource URL are ever sent over the network.

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