Subresource Integrity (SRI) Hash Generator
Generate Subresource Integrity (SRI) integrity strings for web resources. Hashes pasted content with SHA-256, SHA-384, or SHA-512 on-device and emits the integrity attribute value and a ready-to-paste HTML snippet.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
What an integrity value looks like
Paste the exact contents of a script or stylesheet and the tool hashes those bytes with SHA-256, SHA-384 or SHA-512, then prints the integrity value as the algorithm name, a hyphen and the Base64 digest. With a snippet option it wraps that value in a full tag that already carries crossorigin="anonymous".
Pinning a third-party CDN
Use it when a page loads a library or font stylesheet from a CDN and you want the browser to refuse a swapped file. Hash the build you actually ship, so a compromised CDN serving different bytes gets its resource blocked instead of executed.
Choosing the algorithm and the snippet
SHA-384 is the default middle ground. SHA-512 spends a longer digest on more bits and SHA-256 is the shortest. The element option changes only the surrounding markup, not the hash, and the integrity-only choice hands back the bare value for a tag you write yourself.
Hash exactly what the browser fetches
The digest covers the pasted text, so a trailing newline, a file that differs from the deployed one, or an HTML error page served in place of the asset all yield a hash that will not match. Compression is fine, because integrity is checked after decoding.
Digested on your own machine
The bytes go through the browser’s own crypto.subtle in this tab, so vendored or unreleased code is never transmitted and the generator works offline.
Questions
What is SRI?
It lets a browser verify that a fetched script or style matches the published hash, protecting against tampered third-party resources.
Which algorithm is recommended?
sha384 is the widely-used balance; sha512 provides more bits at a larger digest size.
When do I need crossorigin?
Cross-origin resources require the crossorigin="anonymous" attribute for SRI to work correctly.
Related tools
See categoryHTTP Header Analyzer
Paste any HTTP headers and auto-detect, parse and check every one of them.
Repr-Digest Builder & Analyzer
Build or verify modern representation digest fields.
Text Hash Generator
Hash text with MD5, SHA-1, SHA-256, SHA-384 or SHA-512 and output hex, Base64 or base64url.
:nth-child An+B Evaluator
Parse CSS An+B (:nth-child, :nth-of-type) microsyntax, validate it, and list which child indices it matches.