EN
My tools

SRI Hash Generator (Subresource Integrity)

Make Subresource Integrity hashes for your .js and .css files — sha256, sha384, sha512 — with ready <script> and <link> tags. Files never leave your device.

The exact files you serve (minified builds, CDN copies). Choose several at once.
Joined with each file name in the src / href.
My tools →
Advertisement

Subresource Integrity (SRI) protects you when a script or stylesheet is served by a CDN: the integrity attribute holds a hash of the file, and the browser refuses to run anything that does not match — so a compromised CDN cannot inject code into your pages. This generator hashes your .js and .css files with SHA-256, SHA-384 or SHA-512 and writes the complete <script> and <link> tags. Files are read in your browser and never uploaded.

How to use this tool

  1. Choose the exact script and stylesheet files you serve (several at once is fine).
  2. Keep sha384 ticked, or add sha256 / sha512.
  3. Optionally enter the CDN URL prefix so the tags point to the right place.
  4. Copy the tags into your HTML, and regenerate them whenever a file changes.

Formula

integrity = "sha384-" + Base64( SHA-384( file bytes ) )

Several hashes can be listed separated by spaces; the browser uses the strongest one it supports. The hash covers the decoded file content exactly as the server delivers it. Cross-origin files also need crossorigin="anonymous" and a CORS header from the CDN.

Example

A file containing the two lines "Hello world." and "Second line." hashes to sha384-qz16ceSTbRFP2Cq/fJtcq1vCKSYtXMQHaignNteTVrwHtD0BoRRivONxZz8RNNUY — the same value as openssl dgst -sha384 -binary file | base64. For app.js with the prefix https://cdn.example.com/ the tag is <script src="https://cdn.example.com/app.js" integrity="sha384-…" crossorigin="anonymous"></script>.

Frequently asked questions

Can I hash a file straight from its URL?

Not from a browser page: reading another site’s file requires that site to allow cross-origin requests. Download the file (or use your build output) and choose it here, or run openssl dgst -sha384 -binary file.js | base64.

Which algorithm should I use?

sha384 is the common default and what most CDNs publish. sha256 and sha512 also work; listing more than one does not add security, the browser just picks the strongest.

I have the code as text, not a file. What then?

Use the SHA-384 hash tool, which shows the SRI value of pasted text. Make sure line endings and the final newline match the file exactly, or the hash will differ.

Sources

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). SRI Hash Generator (Subresource Integrity). https://kakao.mobile/tools/sri-hash-generator/

MLA

“SRI Hash Generator (Subresource Integrity).” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/sri-hash-generator/.

Advertisement