SRI Hash for Bootstrap CDN
Get the correct SRI integrity hashes for Bootstrap CSS and JavaScript from official CDNs. Ready-to-use link and script tags with SHA-384 integrity verification.
Detailed Explanation
Bootstrap SRI Hashes for Secure Loading
Bootstrap is the world's most popular CSS framework, and its official documentation has always included SRI hashes in its CDN installation instructions. Both the CSS stylesheet and the JavaScript bundle require separate integrity attributes.
Bootstrap 5.3 with SRI
Bootstrap requires two resources — CSS and JS — each with its own integrity hash:
<!-- Bootstrap CSS -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YcnS..."
crossorigin="anonymous"
/>
<!-- Bootstrap JS Bundle (includes Popper) -->
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA..."
crossorigin="anonymous"
></script>
Why Bootstrap Emphasizes SRI
Bootstrap is loaded on an estimated 20%+ of all websites. A compromised Bootstrap CDN file could affect hundreds of millions of users. The Bootstrap team has championed SRI since its introduction, and every official "Getting Started" guide includes integrity attributes.
Separate Hashes for Each File
A common mistake is using a single SRI hash for both the CSS and JS files. Each file has unique content and therefore requires its own hash. When upgrading Bootstrap, you must update both hashes.
Bootstrap Components and SRI
If you load individual Bootstrap components instead of the full bundle, each component needs its own SRI hash:
bootstrap.min.css— full CSSbootstrap.bundle.min.js— JS with Popperbootstrap.min.js— JS without Popper (requires separate Popper SRI)bootstrap-grid.min.css— grid-only CSSbootstrap-utilities.min.css— utilities-only CSS
Verifying Bootstrap Hashes
- Visit the Bootstrap download page to find official hashes
- Cross-reference with jsDelivr or cdnjs published hashes
- Download the file and compute the hash locally
- Use this SRI generator tool to paste the file content and confirm
Upgrade Workflow
When upgrading Bootstrap versions:
- Update the version number in the CDN URL
- Download the new files
- Generate new SRI hashes for each file
- Update both
integrityattributes in your HTML - Test in staging before deploying to production
Use Case
Every website using Bootstrap from a CDN needs SRI hashes for both the CSS and JavaScript files. This applies to corporate websites, admin dashboards, SaaS applications, documentation sites, and prototypes. Bootstrap's official documentation makes it easy — just copy the provided code snippets that already include integrity attributes.