Skip to content

SRI Hash Generator

Generate a Subresource Integrity hash for a script or stylesheet so browsers refuse it if the file ever changes. Enter the URL of a file on a CDN and the tool downloads it and hashes the bytes, or paste the file content itself. You get the integrity value in SHA-256, SHA-384 or SHA-512 and a ready script or link tag.

Reset

Frequently asked questions

What is Subresource Integrity?

An integrity attribute on a script or link tag holds a hash of the file. The browser hashes the file it downloads and refuses to use it when the hashes differ, which protects your page if a CDN or file is compromised.

Which algorithm should I use?

SHA-384 is the most common choice and what most CDNs publish. Browsers accept SHA-256, SHA-384 and SHA-512, and when several are given they use the strongest one they support.

Why does the tag include crossorigin="anonymous"?

Browsers only check integrity for files from another origin when the request uses CORS. crossorigin="anonymous" makes the request without cookies, and the server must answer with an Access-Control-Allow-Origin header. The tool warns when that header is missing.

Is pasted text hashed exactly as entered?

Yes. In text mode the content is hashed as UTF-8 exactly as you paste it, including line endings and the final newline. Even one changed character gives a different hash, so download the exact file when you can.

How large can the file be?

Files up to 5 MB can be downloaded. Redirects are followed, and the final file is hashed.

Does the hash need updating?

Yes, every time the file changes. Hashes therefore suit versioned URLs, such as a CDN path with a fixed version number, rather than URLs that always serve the latest release.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.