SRI hash generator (Subresource Integrity)

Generate the value of an integrity attribute (sha256, sha384, sha512) from the exact content of a script or stylesheet, to protect your pages against silent changes to a resource loaded from a CDN. The calculation happens entirely in your browser.

Example:
Or paste the content directly below.

How it works

Subresource Integrity (SRI) lets the browser verify, before running a script or applying a stylesheet loaded from an external CDN, that its content matches exactly what is expected. The tool calculates the SHA-256, SHA-384 and SHA-512 digests of the content you provide and encodes them in base64 in the algo-hash format, ready to paste into the integrity attribute of a <script> or <link> tag.

How do I use the generated value?

Add it to the tag's integrity attribute, along with crossorigin="anonymous": for example <script src="..." integrity="sha384-..." crossorigin="anonymous"></script>. If the file served by the CDN changes by even a single byte, the browser will refuse to run it.

Which algorithm should I choose?

SHA-384 is the most widely used and is the default recommended by the SRI specification. SHA-256 is still widely supported and sufficient in most cases; SHA-512 provides a longer digest for the most demanding needs. If needed, you can use several algorithms separated by spaces in the same attribute.

Privacy: the calculation is done 100% locally using your browser's native WebCrypto API — the file content is never sent to a server.