Subresource Integrity Generator

Generate SRI values from exact local asset bytes or pasted UTF-8 text.

On-device No sign-up Free to use

Generate integrity hash controls

Drop your file here

or choose one from your device

One file up to 10 MiB. Its exact bytes are hashed without text decoding.

    ?

    Used only when no file is selected. UTF-8 bytes, including line endings, must match the deployed file. Up to 10 MiB.

    ?

    Used in the tag only; never fetched. Ensure the deployed file has identical bytes.

    Result

    Showing an example.

    Hash an empty JavaScript file with SHA-256 and draft its script tag.

    The integrity value is sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=. The HTML draft refers to /assets/empty.js without fetching it.

    Loading the tool. Your result will appear here.

    https://usefreetools.net/subresource-integrity-generator · 20 November 2026

    Was this helpful?

    How to use Subresource Integrity Generator

    1. Select the final local script or stylesheet file, or paste its exact text. A selected file takes priority; pasted text is encoded as UTF-8.
    2. Choose SHA-256, SHA-384 or SHA-512 and the script or stylesheet tag. Enter the asset path/URL to use in that tag.
    3. Generate the integrity value and review its byte count and HTML draft. The URL is not fetched or checked.
    4. Download the tag or JSON record if needed. The delivered asset must retain the exact bytes; a cross-origin asset also needs the appropriate CORS response.

    Example: Subresource Integrity Generator

    Hash an empty JavaScript file with SHA-256 and draft its script tag.

    You add
    Choose a zero-byte file named empty.js. Hash algorithm: SHA-256; HTML tag: Script; deployed path: /assets/empty.js.
    You get
    The integrity value is sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=. The HTML draft refers to /assets/empty.js without fetching it.

    Options

    Paste exact asset text (optional)
    Used only when no file is selected. UTF-8 bytes, including line endings, must match the deployed file. Up to 10 MiB.
    Local script or stylesheet
    One file up to 10 MiB. Its exact bytes are hashed without text decoding.
    Hash algorithm
    Choose SHA-256, SHA-384, SHA-512.
    HTML tag
    Choose Script, Stylesheet.
    Deployed asset URL or path
    Used in the tag only; never fetched. Ensure the deployed file has identical bytes.

    Supported inputs and limits

    • One file or UTF-8 encoded text up to 10 MiB.
    • SHA-256/384/512 uses Web Crypto and requires HTTPS or localhost.
    • A selected file is hashed as stored, including any BOM or line endings.
    • The supplied HTTP(S) URL or relative path labels the tag only and is never fetched.
    • Matching bytes and required cross-origin CORS access must be verified separately.
    More details

    The digest does not establish file safety or publisher trust.

    Where your input is processed

    This tool does not upload your inputs. See the limits for anything saved on your device.

    Even a small byte change changes the digest

    Line-ending conversion, minification or an added comment produces different bytes and therefore a different integrity value. Hash the final artifact rather than an earlier source file. A digest checks agreement with those bytes, not whether the JavaScript or stylesheet is safe.

    Cross-origin use has another requirement

    For an external asset, integrity checking also depends on the asset response permitting the required CORS access. This generator does not query that server, test the URL or publish the tag. Check the actual delivered resource in the consuming browser after deployment.

    Questions about Subresource Integrity Generator

    Does the URL field download the asset?

    No. The page hashes a selected local file or the exact UTF-8 bytes of pasted asset text. The URL is used only in a generated HTML tag.

    Will changing line endings affect the hash?

    Yes. Hashing uses exact bytes, including a byte-order mark and line endings.

    Why can an accurate cross-origin hash still fail?

    The asset server also needs to permit the CORS request.

    Page updated · Project managed by Tony Hines · Report a problem with Subresource Integrity Generator