SRI Hash Generator — Subresource Integrity Online

Generate SHA-256, SHA-384, or SHA-512 Subresource Integrity hashes for CDN-hosted scripts and stylesheets. Output is the complete integrity attribute value ready for your HTML.

Key Features

How to Use

  1. Paste the code or file contents of your CDN asset into the input area.
  2. Select your desired hash algorithm (SHA-384 is W3C recommended).
  3. Click "Generate SRI Hash" to calculate the integrity string.
  4. Copy the complete <script> or <link> HTML tag snippet.

Example

Sample input

https://cdn.example.com/lib/app.min.js

Sample output

sha384-oqVuAfXRKap7fdgcCY5uykM6+i9zGqXExl1d2I7R4N0t0iTPEoVvkX5S4m9X0

Edge Cases

Frequently Asked Questions

What is Subresource Integrity (SRI)?

SRI is a web security feature that enables browsers to verify that resources loaded from third-party CDNs have not been altered or compromised by malicious actors.

Which hash algorithm is best for SRI?

W3C guidelines recommend SHA-384 as an optimal balance between collision resistance and performance, though SHA-256 and SHA-512 are also fully supported.

Why must CDN tags include crossorigin="anonymous"?

Cross-origin requests require CORS headers for the browser to read the response bytes and verify the integrity hash; without crossorigin="anonymous", checks may fail.

Related Tools

Privacy notice: when you run this tool, your input is sent over HTTPS to our server, processed in memory and returned. It is not stored or logged. Avoid pasting live secrets such as private keys or passwords.