← All text tools

SRI Hash Generator

Paste a script or stylesheet, or open the file, and get the Subresource Integrity value (sha256, sha384 or sha512 in Base64) plus a ready script or link tag.

  • Free
  • No sign-up
  • Works on any device

About SRI Hash Generator

Subresource Integrity lets a page say which exact file it expects from a CDN: the browser hashes the download and refuses to run it if the hash differs. The attribute looks like sha384-oqVuAfXRKap7fdgc and uses the Base64 form of the digest, not hex. This page hashes pasted text or an opened file with SHA-256, SHA-384 or SHA-512, builds the integrity value, wraps it in a script or stylesheet tag with crossorigin set, and can compare it with a value you already have.

How to use SRI Hash Generator

  1. Paste the exact script or CSS text, or open the file you plan to host.
  2. Pick sha384 (the usual choice) or another algorithm, choose script or link tag and enter the file URL.
  3. Copy the integrity value or the full tag into your HTML, and hash the file again whenever it changes.

Why use this tool?

Also known as

Frequently asked questions

Why does my hash differ from the one a CDN shows?

The hash covers every byte. A different line ending, a trailing newline or a minified copy gives a different digest, so hash the identical file the browser will download.

Do I need crossorigin on the tag?

For files from another origin, yes. The server must send CORS headers too, otherwise the browser cannot check the hash and will block the file.

Which algorithm should I use?

Browsers accept SHA-256, SHA-384 and SHA-512. SHA-384 is the common recommendation, and you may list several values in one attribute if you want a fallback.

Is SRI Hash Generator free?

Yes. SRI Hash Generator on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.