Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • BS5 Tutorial
  • BS5 Interview Questions
  • BS5 Layout
  • BS5 Content
  • BS5 Components
  • BS5 Helpers
  • BS5 Utilities
  • BS4 Tutorial
  • BS Tutorial
  • Bootstrap Cheatsheet
  • Tailwind
  • CSS Frameworks
  • HTML Formatter
Open In App
Next Article:
How to install Bootstrap 5?
Next article icon

How to install Bootstrap 5?

Last Updated : 28 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Bootstrap 5, a popular front-end framework, empowers developers to create sleek and responsive websites with minimal effort. To install Bootstrap 5, you can choose from three methods including CDN links for quick integration, employ package managers like npm for seamless dependency management, or manually install Bootstrap files for greater customization control.

Table of Content

  • Downloading the Bootstrap File
  • Using CDN Links
  • Using Package Managers

Downloading the Bootstrap File

For those who prefer a hands-on approach, downloading the Bootstrap file is a straightforward method. Here’s how you can do it

Syntax:

<link rel="stylesheet" href="path/to/bootstrap.min.css">
<script src="path/to/bootstrap.bundle.min.js"></script>

Steps to Install the Bootstrap 5

Step 1: Download Bootstrap 5

Navigate to the official Bootstrap website (https://getbootstrap.com/) and locate the "Download" button. Click on it to download the latest version of Bootstrap. You'll receive a ZIP file containing the necessary files.

Screenshot-from-2024-02-08-08-34-52
download button on getbootstrap.com

Step 2: Extract the ZIP File

Once the download is complete, locate the ZIP file in your downloads folder and extract its contents. You can do this by right-clicking on the file and selecting "Extract All" or using your preferred extraction tool.

Step 3: Include Bootstrap Files

Inside the extracted folder, you'll find various files and directories. For a basic setup, you only need the CSS and JS files. Copy the 'css' and 'js' folders to your project directory.

Screenshot-from-2024-02-08-08-48-30
css and js file

Step 4: Link Bootstrap CSS

Open your HTML file using a text editor. Inside the <head> section, include the Bootstrap CSS file by adding the following line:

Make sure the path to the CSS file is correct relative to your HTML file. ( see the code below)

Step 5: Link Bootstrap JS

To enable Bootstrap's JavaScript features, include the Bootstrap JS file. Add the following lines just before the closing </body> tag:

Again, verify that the path to the JS file is accurate.

Screenshot-from-2024-02-08-09-09-58
folder structure

Step 6: Utilize Bootstrap Components

With the CSS and JS linked, you can now start using Bootstrap's components and utilities in your HTML. Refer to the official Bootstrap documentation for a wide range of components and their implementation.

Example: Illustration of Installation of Bootstrap 5 File.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport"            content="width=device-width, initial-scale=1.0">     <title>GfG</title>     <link rel="stylesheet" href="css/bootstrap.min.css"> </head>  <body>      <h3 class="bg-success text-white ">GeeksforGeeks</h3>     <script src="js/bootstrap.bundle.min.js"></script>  </body>  </html> 

Output:

Screenshot-from-2024-02-08-08-40-33
Output of index.html file

Using CDN Links

A Content Delivery Network is a network of distributed servers strategically placed around the globe to deliver web content efficiently to users. You can use CDN links to access Bootstrap's CSS and JS files directly from remote servers. By integrating these CDN links in your HTML file, you ensure that your website benefits from the latest version of Bootstrap while taking advantage of the speed and reliability offered by the CDN.

Syntax:

<!-- Bootstrap 5 CSS via CDN -->
<link rel="stylesheet" href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">

<!-- Bootstrap 5 JS via CDN -->
<script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"> </script>

Linking Bootstrap 5 CSS via CDN:

<link rel="stylesheet" href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">

Linking Bootstrap 5 JS via CDN:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

Example: Illustration of installation of Bootstrap5 via CDN Links.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport"            content="width=device-width, initial-scale=1.0">     <title>GfG</title>     <link rel="stylesheet" href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"> </head>  <body>      <h3 class="bg-success text-white ">       GeeksforGeeks       </h3>     <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js">       </script> </body>  </html> 

Output:

Screenshot-from-2024-02-08-08-40-33
Output using CDN link

Using Package Managers

This method involves using package managers like npm or yarn to install and manage Bootstrap as a dependency in your project.

Syntax:

// Using npm
npm install bootstrap

// Using yarn
yarn add bootstrap

Package.json File:

{
"dependencies": {
"bootstrap": "^5.3.2"
}
}

Project Structure:

Screenshot-from-2024-02-11-01-43-26
Project structure

Approach:

Utilize package managers like npm or yarn to install Bootstrap. Include the Bootstrap files in your project through the package manager. Open your terminal and navigate to your project directory. Run either of the following commands based on your package manager preference

Syntax:

//Using npm 
npm install bootstrap

// Using yarn
yarn add bootstrap

Steps to Install the Bootstrap 5

  • Navigate to Your Project Directory:

Open your terminal and go to the directory where you want to create your project.

cd path/to/your/project

  • Create index.html:

Create a new file named index.html in your project directory.

touch index.html

  • Edit index.html with a Text Editor:

Open index.html in your preferred text editor. You can use Visual Studio Code, Sublime Text, Atom, or any other editor of your choice.

( This command opens the file in Visual Studio Code, replace with your editor's command)

code index.html 

  • Add Basic HTML Structure:

Inside index.html, start by adding the basic HTML structure.

Example: Illustration of installation of Bootstrap5 using Package Manager.

  • Link Bootstrap CSS:

Inside the <head> section, add a link to the Bootstrap CSS file. Since we installed Bootstrap using npm, the path will be relative to the node_modules directory.


<!-- Inside the <head> section -->
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">

  • Link Bootstrap JS:

Just before the closing </body> tag, add a script tag to link the Bootstrap JS file.


<!-- Just before the closing </body> tag -->
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>

  • Add Bootstrap Components:

Now, you can start using Bootstrap components in the <body> section. For example, let's add a Bootstrap navbar.

  • Save and Close:

Save the index.html file and close your text editor.

  • Open in Browser:

Open index.html in your web browser to see the Bootstrap styles and components in action.

(This command opens in the default browser on macOS, replace with your platform's command)

open index.html  

Example: Illustration of installation of Bootstrap5 via Package managers.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport"            content="width=device-width, initial-scale=1.0">     <title>GeeksforGeeks</title>        <!-- Inside the <head> section -->     <link rel="stylesheet" href= "node_modules/bootstrap/dist/css/bootstrap.min.css"> </head>  <body>     <div class="bg-success text-white h1">           Welcome to GeeksforGeeks       </div>     <script src= "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js">       </script>  </body>  </html> 

Output:

Screenshot-from-2024-02-11-01-40-34
Output

Next Article
How to install Bootstrap 5?

I

isandeep2183
Improve
Article Tags :
  • Web Technologies
  • Bootstrap
  • Bootstrap-Questions
  • Bootstrap-5

Similar Reads

    How to Install Bootstrap in Angular?
    If you have completed your practice in the field of HTML & CSS and want to develop more interesting and attractive webpages in the future, moving ahead for the Bootstrap topic along with the Angular concept will be appropriate for you. However, to have Bootstrap on your Angular Project you shoul
    5 min read
    How To Install Bootstrap in ReactJS?
    Bootstrap is one of the most popular CSS frameworks for developing responsive and mobile-first websites. Integrating Bootstrap with ReactJS helps you build sleek, responsive interfaces quickly and easily. In this article, we will walk you through the step-by-step process of installing Bootstrap in R
    4 min read
    How to use Bootstrap in React JS ?
    Explore the seamless integration of Bootstrap into React JS for enhanced styling and responsive web development. This comprehensive guide provides step-by-step instructions, covering the installation process, utilization of Bootstrap components, and best practices to harness the power of both techno
    3 min read
    Bootstrap 5 Small tables
    Bootstrap 5 Small tables are used to create the small size of tables. These tables are just smaller versions of the normal tables. Bootstrap 5 Small tables Class: table-sm: By using this class we can convert a normal table into a smaller table by cutting all cell padding in half. Syntax: <table c
    2 min read
    How to Add Bootstrap in a Project?
    Bootstrap is a popular open-source framework for building responsive and mobile-first websites using HTML, CSS, and JavaScript. It provides pre-designed components and templates that simplify web development. Why Use Bootstrap?Bootstrap offers several advantages for web development:Faster and Easier
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences