Toolgeist › Security

SRI Hash Generator — Subresource Integrity for <script>/<link> Tags

Paste a script or stylesheet URL, or the file content directly, to generate its Subresource Integrity (SRI) hash — the integrity="sha384-…" attribute that tells a browser to refuse a CDN-hosted file if it does not match exactly, protecting you if that CDN is ever compromised.

How to use SRI Hash Gen

  1. Paste the file content or fetch it from a URL.
  2. Choose the hash algorithm (SHA-384 is the common default).
  3. Copy the generated integrity="…" attribute.
  4. Paste it into your <script> or <link> tag alongside crossorigin="anonymous".

Frequently asked questions

Why use SRI for a CDN script?
If the CDN is compromised or serves a modified file, SRI makes the browser refuse to execute it instead of silently running malicious code on your page.
Which algorithm should I pick?
SHA-384 is the widely used default and is what most CDN-provided integrity attributes already use; SHA-256 and SHA-512 are also valid per the spec.
Do I need crossorigin="anonymous" too?
Yes — SRI verification requires the resource to be fetched with CORS, so the crossorigin attribute is required alongside integrity for a cross-origin URL.

Related Security tools

Also searched for: sri hash generator · subresource integrity generator · sha384 integrity attribute

Browse all 738 free tools on Toolgeist →