Handitab

SRI Hash Generator

Generate a Subresource Integrity (SRI) hash for a script or stylesheet from its contents, with a ready-to-paste integrity attribute.

About SRI Hash Generator

Subresource Integrity (SRI) is a W3C browser feature that blocks a script or stylesheet if its content does not match a hash in the integrity attribute. This tool computes the SHA-256, SHA-384, or SHA-512 digest of the text with the Web Crypto API and encodes it in Base64 with the algorithm prefix. The text is hashed as UTF-8, so the result matches only a UTF-8 file that is unchanged byte for byte.

How to use SRI Hash Generator

  1. Type or paste into the "JS or CSS file contents (paste the text or open the file)" box, or press "Use example" to try it with sample data.
  2. Set "Algorithm" if the defaults do not fit.
  3. The result appears below and updates as you type.
  4. Copy the result with the copy button, or download it as a file where that is offered.

Questions about SRI Hash Generator

Why does the browser block my file even though I added the integrity hash?

The hash must match the exact bytes served. A different version, minification by the CDN, or changed line endings all alter it. Cross-origin files also need the crossorigin attribute and CORS headers from the host.

Which SRI algorithm should I choose?

SHA-384 is the common default and the one most CDNs publish. Browsers accept all three options, and if several hashes are listed in one attribute, the browser uses the strongest one it supports.

Runs in your browser. Page last updated .

More security tools

All 10 security tools