SRI Hash Generator
Generate Subresource Integrity hashes for scripts and stylesheets. Paste content directly or fetch from a CDN URL to produce a ready-to-use integrity attribute.
What is Subresource Integrity (SRI)?
SRI lets browsers verify that files fetched from CDNs or third-party servers have not been tampered with. You provide a cryptographic hash of the expected content in the integrity attribute. If the fetched file does not match the hash, the browser refuses to execute it — protecting your users from supply-chain attacks, compromised CDNs, and man-in-the-middle injections. The crossorigin="anonymous" attribute is required so the browser can read the response bytes for verification.
Script or stylesheet content — pasted directly or fetched from a CDN URL
Content converted to UTF-8 bytes using TextEncoder — ensures consistent hashing across platforms
Web Crypto API computes the digest using SHA-256, SHA-384, or SHA-512 — runs natively in the browser
Raw hash bytes Base64-encoded and prefixed with the algorithm name — e.g. sha384-...
Ready-to-use integrity attribute and complete HTML tag with crossorigin="anonymous"
Spec: W3C Subresource Integrity (SRI), FIPS 180-4 (SHA-2), Web Crypto API