Installing Bootstrap: CDN, Download & npm

Bootstrap Framework 9 min min read Updated: Nov 16, 2026 Beginner
Installing Bootstrap: CDN, Download & npm
Beginner Topic 2 of 6

Three Ways to Use Bootstrap

Before you can use Bootstrap you need to add its CSS (for styling) and JavaScript (for interactive parts) to your page. There are three common ways to do it.

MethodBest ForInternet Needed?
CDN linksBeginners, quick demos and small projectsYes
Download filesOffline use and learning how files are organizedNo
npm packageModern projects with build tools and SassOnly to install

Method 1: CDN (Easiest)

A CDN (Content Delivery Network) is a fast server that already hosts the Bootstrap files. You only add two links to your HTML and Bootstrap works.

html <!-- In the <head> --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"> <!-- Just before </body> --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
  • The CSS link goes in the <head>, so the styles load first
  • The JS bundle goes at the end of <body>, so the page shows quickly
  • bootstrap.bundle.min.js already includes Popper, which dropdowns and tooltips need
Version number: The @5.3.8 in the link is the Bootstrap version. You can change it to another 5.3.x version if you need a specific release. Always check the official Bootstrap website for the latest version.

Method 2: Download the Files

  1. Open the official Bootstrap website and go to the Download page.
  2. Click Download to get the compiled CSS and JS zip file.
  3. Unzip it and copy the css and js folders into your project.
  4. Link them using local paths.
html <link href="css/bootstrap.min.css" rel="stylesheet"> <script src="js/bootstrap.bundle.min.js"></script>

Method 3: npm (For Modern Projects)

If you use Node.js, open the terminal in your project folder and run:

bash pm init -y npm install bootstrap

The files are saved in node_modules/bootstrap/dist/. In a build tool such as Vite or webpack you can then import them:

javascript import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap';

How to Check That Bootstrap Works

Add this small test inside your <body>. If the text appears in a green box, Bootstrap is working.

html <div class="alert alert-success">Bootstrap is working!</div>
Result

A light green alert box with the text Bootstrap is working!

Common Mistakes

  • Putting the JS file in the <head> before the content, which can slow the page
  • Typing the wrong file path when using downloaded files
  • Loading Bootstrap 4 CSS with Bootstrap 5 JS, or the other way around
  • Forgetting the internet connection when using a CDN

Conclusion

For learning, the CDN is the quickest option. Later, when you build bigger projects, npm gives you more control and lets you customize with Sass.

Quick Summary: Use two CDN links (CSS in head, JS bundle before end of body), or download the files, or install with npm.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators