SRI Hash Generator
Generate Subresource Integrity hashes for your JavaScript and CSS files. Supports SHA-256, SHA-384 and SHA-512. Free, private, runs entirely in your browser.
Note: The remote server must allow CORS. If the fetch fails, paste the file content instead.
What is SRI?
Subresource Integrity (SRI) lets browsers verify that resources fetched from CDNs or third-party servers have not been tampered with. A cryptographic hash is included in the integrity attribute of script or link elements.
Why SHA-384?
SHA-384 is the recommended algorithm for SRI. It provides strong security while generating shorter hashes than SHA-512. All modern browsers support SHA-256, SHA-384, and SHA-512 for integrity checks.
CORS requirement
For SRI to work with cross-origin resources, you must include crossorigin="anonymous" on the element. Without it, the browser skips the integrity check entirely.
How to Use SRI Hash Generator
The Subresource Integrity (SRI) Hash Generator creates cryptographic hashes for external scripts and stylesheets so browsers can verify file integrity before execution. This protects your site against compromised CDNs and supply-chain attacks. Generate SHA-256, SHA-384, or SHA-512 hashes directly in your browser.
Open the SRI Hash Generator
Navigate to the SRI Hash Generator from the cybersecurity tools section. The tool provides a clean interface for generating integrity hashes for any external resource.
Provide the Resource
Enter the URL of the external script or stylesheet, or paste the file contents directly. The tool will fetch or process the content to compute the cryptographic hash.
Select the Hash Algorithm
Choose from SHA-256, SHA-384, or SHA-512. SHA-384 is the most commonly recommended for SRI and offers an excellent balance of security and compatibility.
Generate the Hash
Click the generate button to compute the base64-encoded hash. The tool outputs the full integrity attribute value ready for use in your HTML tags.
Copy the HTML Tag
Copy the complete script or link tag with the integrity and crossorigin attributes already included, ready to paste directly into your HTML document.
Common Use Cases
Securing CDN-Hosted Libraries
Add integrity hashes to all third-party JavaScript libraries loaded from public CDNs to ensure tampered files are blocked before execution.
Compliance with Security Policies
Meet organizational or regulatory requirements that mandate subresource integrity checks on all externally hosted resources.
Protecting Against Supply-Chain Attacks
Prevent compromised CDN or package registry resources from injecting malicious code into your website by enforcing hash verification.
Auditing Existing Websites
Generate hashes for resources already in use to verify they match expected content and add SRI attributes where they are missing.
Pro Tips
- -Always include the crossorigin='anonymous' attribute alongside the integrity attribute, or the browser will skip the integrity check.
- -Generate a new hash each time you update the version of an external library, as even minor changes will produce a completely different hash.
- -Use SHA-384 as your default algorithm; it is recommended by the W3C specification and supported by all modern browsers.
- -Combine SRI with Content Security Policy (CSP) headers for a defense-in-depth strategy against script injection attacks.
- -Test your SRI implementation in a staging environment before deploying to production to avoid accidentally blocking legitimate resources.
You might also like
URL Encode/Decode
Encode or decode URLs and query parameters instantly.
CybersecurityOpen Port Checker
Check if common ports are open on a host or IP.
CybersecurityBorder Radius Generator
Create custom CSS border-radius with an interactive visual editor.
DeveloperBase64 to Image
Convert Base64 strings back to downloadable images.
Image