All tools

SRI Hash Generator

Hash

Generate Subresource Integrity (SRI) hashes for a script or stylesheet: SHA-256, SHA-384, and SHA-512, ready to drop into an HTML integrity attribute.

Paste the exact content of a script or stylesheet and get back its Subresource Integrity hash for SHA-256, SHA-384, and SHA-512, each formatted as the base64 string an HTML integrity attribute expects. SRI lets a browser verify that a file loaded from a CDN or third-party host hasn't been tampered with, by comparing it against a hash you computed ahead of time. This is content-based hashing, not a URL fetcher: it never downloads anything, so the input needs to be the exact bytes that will actually be served, including whitespace and line endings, since any difference produces a completely different hash.

sriintegrityhashsecurityhtmlsubresource-integrity

How to use SRI Hash Generator

  • 1.Paste the exact script or stylesheet content you'll be serving, byte-for-byte.
  • 2.Copy the integrity value for whichever algorithm your build tool or CDN already uses (SHA-384 is the common default).
  • 3.Add it to the script or link tag's integrity attribute along with crossorigin="anonymous".

Frequently asked questions

Does this fetch the file from a URL for me?
No, it only hashes the content you paste in. If you need to hash a remote file, download it first and paste its exact contents.
Why does my hash not match what I expected?
SRI hashes are byte-sensitive: a different line ending, trailing newline, or any post-minification edit produces a completely different hash. Hash the exact bytes that will be served.
Which algorithm should I use?
SHA-384 is the most common default and what most CDNs (like cdnjs and jsDelivr) publish. SHA-256 and SHA-512 both work too; browsers accept whichever you provide.
Do I still need crossorigin on the tag?
Yes, for a cross-origin script or stylesheet, integrity checking only works alongside crossorigin="anonymous" (or "use-credentials" if the resource requires it).

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/sri-hash-generator \
  -H "Authorization: Bearer utx_live_..." \
  -H "Content-Type: application/json" \
  -d '{"content":"console.log(1)"}'

Get an API key from your dashboard · Full API docs →