0

SRI Hash Generator

Generate a Subresource Integrity hash for any JS or CSS file and get a ready-to-paste script or link tag.

🔗

Drag & Drop Image

Works with any JS or CSS file — nothing is uploaded, the hash is computed locally.

Subresource Integrity only permits sha256, sha384 or sha512 digests, base64-encoded — this tool restricts the choices accordingly so the output is always spec-correct.

Buy Me a Coffee at ko-fi.com
Processing... 0%
Reading file
Computing digest
Encoding to base64
Done

Result

Subresource Integrity (SRI) lets a browser verify that a script or stylesheet fetched from a CDN or third-party host has not been altered before it runs — the browser hashes the downloaded bytes and refuses to execute the file if the digest does not match the integrity attribute you published. This tool computes that digest for any JS or CSS file you drop in, entirely inside your browser tab, so the file itself never needs to leave your machine to be hashed.

A generic hash tool will not produce a usable SRI value: the spec requires a base64-encoded digest, not the hexadecimal string most checksum tools print, and it only recognizes three algorithms — sha256, sha384 and sha512. This generator restricts the algorithm choice to exactly those three and encodes the result the correct way, then goes one step further by composing the full HTML tag around it, with a placeholder src or href field you can edit in place before copying.

Under the hood the file is read with the File API, hashed with the native crypto.subtle.digest() implementation, and the resulting bytes are converted to base64 in small chunks rather than with a single large spread operation — a detail that matters once a bundled JS file grows past roughly a hundred thousand bytes, where naive conversion approaches can hit a browser's call-stack limit.

sha384 is selected by default because it is the algorithm most commonly recommended in SRI examples and documentation, balancing digest length against collision resistance, but sha256 and sha512 are one click away if a build pipeline or CDN provider specifies a different requirement.