SRI Hash Generator

Generate Subresource Integrity hashes for script and link tags. Compute SHA-256, SHA-384, and SHA-512 integrity attributes instantly.

About This Tool

The SRI Hash Generator computes Subresource Integrity hashes for JavaScript and CSS files directly in your browser. SRI is a W3C security standard that lets browsers verify that resources fetched from CDNs or third-party servers have not been tampered with. By adding an integrity attribute to your <script> or <link> tags, browsers will refuse to execute the resource if the hash does not match, protecting your site from supply-chain attacks.

This tool generates SHA-256, SHA-384, and SHA-512 hashes simultaneously. SHA-384 is the most commonly used algorithm for SRI because it offers a good balance between security and performance, and it is the default recommended by the W3C specification. All three algorithms are computed using the browser's built-in Web Crypto API, which provides hardware-accelerated, constant-time implementations — the same API used by our Hash Generator for general-purpose hashing.

SRI hashes are essential when loading resources from public CDNs like cdnjs, jsDelivr, or unpkg. If an attacker compromises the CDN and modifies the hosted file, the SRI hash will no longer match and the browser will block the resource. This is especially important for security-sensitive applications. For additional protection, consider setting a Content Security Policy header that enforces SRI via the require-sri-for directive.

You can paste file content directly, upload a .js or .css file via drag-and-drop, and optionally provide the resource URL to get a ready-to-paste HTML tag. The tool also shows the input size so you can monitor file weight. All processing happens client-side — your code and files are never transmitted to any server. If you need to generate meta tags for your page alongside SRI tags, check out our Meta Tag Generator.

How to Use

  1. Paste the JavaScript or CSS file content into the File Content textarea, or drag and drop a .js / .css file.
  2. Optionally enter the Resource URL (e.g. a CDN URL) to include it in the generated HTML tag.
  3. Click Generate All or press Ctrl+Enter to compute SHA-256, SHA-384, and SHA-512 hashes simultaneously.
  4. Toggle between