SRI Hash for Scripts
Generate an SRI hash for JavaScript files loaded from a CDN or another host. Add the integrity and crossorigin attributes to your script tag so the browser only runs the file if it matches the expected hash.
Create SRI hashes for your scripts and stylesheets and get a ready-to-use HTML tag. Fast, free and no signup.
Enter the file URL in the Resource URL field on the right. The file is fetched by your browser, so the server must allow cross-origin (CORS) requests. Most CDNs do.
Paste code, upload a file or load it from a URL.
Pick the hash algorithm and the type of tag you need.
Copy the integrity value or the full HTML tag into your page.
Looking for a free Subresource Integrity generator? Create an SRI hash for any JavaScript or CSS file online. Paste your code, upload a file or load a file from a URL, choose SHA-256, SHA-384 or SHA-512, and get the integrity attribute and a ready-to-use HTML tag in seconds. No software, no account and no watermark. Everything runs in your browser, so your code stays on your device.
Generate an SRI hash for JavaScript files loaded from a CDN or another host. Add the integrity and crossorigin attributes to your script tag so the browser only runs the file if it matches the expected hash.
Protect external CSS files the same way. Choose the stylesheet option to get a complete link tag with the integrity value already included, ready to paste into your page head.
Pick the algorithm that fits your needs. SHA-384 is a common choice and is used by many popular CDNs, while SHA-256 and SHA-512 are also supported by modern browsers.
Subresource Integrity is a browser security feature that lets you verify that a file loaded from another server has not been changed. You add a cryptographic hash of the expected file to the integrity attribute of a script or link tag. When the browser downloads the file, it calculates the hash and compares it with your value. If the two do not match, the browser blocks the file.
This is useful when you load libraries, fonts or stylesheets from a CDN or any third-party host. If that file is modified, accidentally or maliciously, the browser will not run or apply it.
You can create an SRI hash for your file by following these simple steps.
When you load a file from a different origin, the browser needs permission to read it before it can check the hash. The crossorigin="anonymous" attribute asks for the file using a CORS request. The host must also send a valid CORS header. Our generated tags include this attribute so the integrity check can work correctly with CDN files.
An SRI hash matches one exact version of a file. If the file changes, even by a single character, the hash will no longer match and the browser will block it. For this reason SRI works best with versioned files that do not change, such as a library with a fixed version number in its URL. Whenever you update the file, generate a new hash and replace the old one.
Our free Subresource Integrity generator helps developers add an extra layer of protection to pages that rely on external files. The tool works without signup or a watermark, and your files are processed locally in your browser instead of being uploaded to a server.
Find answers to common questions about Subresource Integrity, hash algorithms and adding SRI to your website.
An SRI hash is a cryptographic fingerprint of a script or stylesheet. You place it in the integrity attribute of your tag, and the browser compares it with the hash of the downloaded file. If they do not match, the file is blocked.
Enter the CDN file URL in the Resource URL field, choose the From URL option, select an algorithm and click Generate. If the CDN does not allow browser requests, download the file and use the Upload file option instead.
All three are supported by modern browsers. SHA-384 is a common and balanced choice. SHA-256 produces a shorter value, and SHA-512 produces a longer one. Pick the one that suits your project or your security policy.
The most common reasons are that the file changed after the hash was created, the hash was copied incorrectly, or the host does not send a CORS header. Generate the hash again from the exact file your page loads and make sure crossorigin="anonymous" is included.
Yes. SRI works with script tags and with link tags for stylesheets. Use the Tag type setting to get the correct tag for your file.
The old hash will no longer match, and the browser will block the updated file. Generate a new SRI hash whenever the file changes. Using versioned file URLs helps avoid unexpected changes.
Pasted code and uploaded files are processed in your browser and are not sent to our server. When you use the From URL option, your browser requests the file directly from the address you enter.
Merge, split, compress and convert files in seconds. Explore powerful free tools for all your everyday needs.
Explore All Tools →