Subresource Integrity Hash
Generate SRI integrity hashes for scripts and styles.
How to use
- 1 Paste the exact contents of the script or stylesheet you serve.
- 2 Choose an algorithm — SHA-384 is the common default.
- 3 Click Generate to compute the integrity hash.
- 4 Copy the integrity value or the full script snippet into your HTML.
About Subresource Integrity Hash
The Subresource Integrity Hash generator produces the cryptographic digest browsers use to verify that a script or stylesheet loaded from a CDN has not been altered.
Paste the exact contents of the file you serve, choose an algorithm, and the tool returns a base64-encoded SHA digest prefixed with the algorithm name — the value that goes inside an HTML integrity attribute, such as sha384-oqVuAfXR… A browser recomputes the hash of the fetched file and refuses to run it if the values do not match, which protects your visitors if the CDN is ever compromised.
You can pick any of the three algorithms the SRI specification permits: SHA-256, SHA-384 or SHA-512.
SHA-384 is the value most CDNs publish and a sensible default.
The tool also assembles a complete, paste-ready script snippet with the integrity attribute and crossorigin="anonymous" already set, so you can drop it straight into your markup.
Hashing happens entirely in your browser with the Web Crypto API — your file contents are never uploaded or logged.
One thing to remember: the hash must match the served bytes exactly, so generate it from the final, minified, built file you actually deploy rather than the source, and regenerate it whenever the file changes.
FAQ
Which algorithm should I use?
SHA-384 is what most CDNs publish and a good default. SHA-256 and SHA-512 are also valid SRI algorithms; all three are supported here.
Why does my hash not match the file?
SRI hashes the served bytes exactly. Generate the hash from the final minified/built file you deploy, not the source, and regenerate it after any change.
Is my file uploaded anywhere?
No. The digest is computed locally with the Web Crypto API; nothing leaves your browser.