Skip to content
⚠ TESTING ENVIRONMENT You are viewing a testing copy of Tolioo. Changes here do not affect the live website.

Subresource Integrity Generator

Create SRI hashes for your scripts and stylesheets and get a ready-to-use HTML tag. Fast, free and no signup.

  • 100% free
  • No Signup
  • Runs in your browser

Your resource

Your SRI hash is ready

Integrity value
HTML tag
ADVERTISEMENT
Demo Ad 728 x 90

How to generate an SRI hash

1Add your file

Paste code, upload a file or load it from a URL.

2Choose settings

Pick the hash algorithm and the type of tag you need.

3Copy the tag

Copy the integrity value or the full HTML tag into your page.

SRI GUIDE

Subresource Integrity Generator – Create SRI Hashes Online

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.

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.

SRI Hash for Stylesheets

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.

SHA-256, SHA-384 and SHA-512

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.

What Is Subresource Integrity (SRI)?

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.

How to Generate an SRI Hash Online

You can create an SRI hash for your file by following these simple steps.

  1. Add your resource: Paste the code, upload a .js or .css file, or enter a file URL.
  2. Choose the algorithm: Select SHA-256, SHA-384 or SHA-512.
  3. Select the tag type: Choose a script tag or a stylesheet link tag.
  4. Generate the hash: Click the button to calculate the integrity value.
  5. Copy and use it: Copy the integrity value or the full tag and add it to your HTML page.

Why the crossorigin Attribute Matters

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.

Keep Your SRI Hash Up to Date

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.

Free SRI Generator Online

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.

ADVERTISEMENT
Demo Ad 300 x 250
COMMON QUESTIONS

Frequently Asked Questions About SRI Hashes

Find answers to common questions about Subresource Integrity, hash algorithms and adding SRI to your website.

What is a Subresource Integrity (SRI) hash?

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.

How do I generate an SRI hash for a CDN file?

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.

Which algorithm should I choose: SHA-256, SHA-384 or SHA-512?

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.

Why is the browser blocking my file after I added SRI?

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.

Can I use SRI for both JavaScript and CSS?

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.

What happens when the file is updated?

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.

Is it safe to use this SRI generator with private code?

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.

ADVERTISEMENT
Demo Ad 320 x 50

All Tools, One Place

Merge, split, compress and convert files in seconds. Explore powerful free tools for all your everyday needs.

Explore All Tools →
'; } submit.addEventListener('click', function () { clearError(); var mode = currentMode, algo = val('algo'); if (!window.crypto || !window.crypto.subtle) { return showError('Your browser does not support secure hashing. Please use a modern browser over HTTPS.'); } submit.disabled = true; submit.querySelector('.sri-submit-text').textContent = 'Generating…'; getBytes(mode).then(function (data) { return crypto.subtle.digest(algo, data).then(function (digest) { var integrity = algo.toLowerCase().replace('-', '') + '-' + toBase64(digest); $('sri-hash').textContent = integrity; $('sri-tag').textContent = escapeTag(build(integrity)); $('sri-meta').textContent = algo + ' · ' + (data.byteLength || data.length) + ' bytes hashed'; result.classList.add('show'); result.scrollIntoView({ behavior: 'smooth', block: 'start' }); }); }).catch(function (e) { showError(e.message || 'Something went wrong. Please try again.'); }).then(function () { submit.disabled = false; submit.querySelector('.sri-submit-text').textContent = 'Generate SRI hash'; }); }); /* ---------- Copy ---------- */ document.querySelectorAll('.sri-copy').forEach(function (btn) { btn.addEventListener('click', function () { var t = $(btn.getAttribute('data-target')).textContent; var done = function () { btn.textContent = 'Copied!'; setTimeout(function () { btn.textContent = 'Copy'; }, 1500); }; if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(t).then(done); } else { var ta = document.createElement('textarea'); ta.value = t; document.body.appendChild(ta); ta.select(); try { document.execCommand('copy'); done(); } catch (e) {} document.body.removeChild(ta); } }); }); /* ---------- Reset ---------- */ $('sri-reset').addEventListener('click', function () { text.value = ''; urlIn.value = ''; fileIn.value = ''; pickedFile = null; fName.textContent = 'Drag & drop your .js or .css file here'; fSize.textContent = 'or'; currentMode = 'paste'; setMode(); result.classList.remove('show'); clearError(); window.scrollTo({ top: 0, behavior: 'smooth' }); }); })();