Skip to main content
GuideBest practicesBeginner

Subresource Integrity (SRI): verify external resource integrity

Understand how SRI hashes help detect unexpected changes to static third-party scripts and stylesheets, and where SRI does not apply.

Published 29 August 2026Reading : 1 minBy Yann Bastien

Subresource Integrity lets a page declare the expected cryptographic hash of a static external script or stylesheet. If the downloaded bytes do not match, the browser refuses the resource.

Generate the fingerprint with the SRI hash generator and keep the integrity value synchronized with the exact file version. The crossorigin behavior must also match how the resource is served.

SRI is useful for versioned CDN assets, but it is not a universal third-party security system. Frequently changing resources are awkward to pin, and SRI does not decide whether the code you approved is safe. It verifies integrity of expected bytes, not trustworthiness.

For the broader distinction between hashes and authenticity, continue with hashes and integrity.

Was this article useful?