Why is everyone trying to do it the hard way? Sure, some of these approaches will work, but they're more complicated than is necessary.

OK, first - you need an image that will fit within your navbar. You can adjust your image via css height attribute (allowing width to scale) or you can just use an appropriately sized image. Whatever you decide to do - the way this looks will depend on how well you size your image.

For some reason, everyone wants to stick the image inside of an anchor with navbar-brand, and this isn't necessary. navbar-brand applies text styles that aren't necessary to an image, as well as the navbar-left class (just like pull-left, but for use in a navbar). All you really need is to add navbar-left.

<a href="#" class="navbar-left"><img src="/path/to/image.png"></a>

You can even follow this with a navbar-brand item, which will appear to the right of the image.

Answer from Michael on Stack Overflow
🌐
MDBootstrap
mdbootstrap.com › standard › header with logo
Bootstrap Header with logo - free examples & tutorial
Responsive Header with logo built with Bootstrap 5. Simple examples of navigation headers with logo. Easy to implement and customize.
🌐
Start Bootstrap
startbootstrap.com › snippets › navbar-logo
Bootstrap Navbar Brand Logo Example
An example Bootstrap navbar with an image as the navbar brand logo
🌐
Tutorial Republic
tutorialrepublic.com › codelab.php
Live Demo: Bootstrap Navbar with Logo Image
View the live example as well as try and test it using the online HTML editor.
🌐
MDBootstrap
mdbootstrap.com › standard › logo
Bootstrap Logo - free examples, templates & tutorial
Responsive Logo built with Bootstrap 5. Navbar with logo, logo centered in Navbar, logo above the navbar, logo carousel & more.
Top answer
1 of 15
2
Kathleen, · Reading over some of the comments, I get the impression that some people seem to think that, when using Bootstrap, you should abide by the rules of Bootstrap. Nothing is further from the truth. · As a youngster, I used to love reading Enid Blyton's books named The Famous Five. The good part about the series was that I did not have to read the books in sequence, in fact I did not even have to read all of the books. If there was a book that I did not like, I did not read it. · So too with Bootstrap, instead of a library of books, it is a library of code from which to pick and choose.   · Take a look athe the following web page, you would not recognise it as a Bootstrap site. It was developed by adding an extra two score and ten (or thereabout) lines of CSS on top of Bootstrap.. · Nancy's example shows another use of Bootstrap where she has chosen to use a variant of the Bootstrap menubar. · What I am trying to say is, that Bootstrap is a tool to get you where you want, not where Bootstrap is leading you. It's not a this or nothing kind of workflow. Of course you must always keep in mind that a working knowledge of HTML, CSS and JS is a primary requirement. · Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
2 of 15
0
What is the height and width of your image? · Are you using SVG  or JPG/PNG? · You may need to resize the logo and adjust the height of your navbar to accommodate the image size you're working with. · .navbar-default .navbar-header .navbar-brand { ·   margin: 0; ·   padding: 0; ·   height: 53px;  /**adjust as needed**/ · } · Nancy O'Shea— Product User, Community Expert & Moderator
Top answer
1 of 2
2

To keep your header image inside your header at all times you can simply apply max-height: 100%; to your image. This will stop it from overflowing its container. Here is an example: https://jsfiddle.net/rktr4q5v/1/

You can see that the images are both quite small. This is because the class navbar-brand has a height of 50px applied. If you remove this then your images will expand to their original width but remain inside the navbar. Here is an example of this: https://jsfiddle.net/rktr4q5v/2/

If you need to do specific size styling for your logos then you will need to use media queries to change the size of your logo at different screen widths. The documentation for this can be found here and a beginners guide can be found here

2 of 2
1

I have also fixed some of your mistakes. You can refer this.

Adjust your Logo Size in navbar-brand style tag. If requires

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Test</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="test2.css">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="navbar navbar-default " role="navigation">
     <div class="container-fluid">

      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
          <span class="sr-only">Toggle Navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#"><img src="https://static.pexels.com/photos/34950/pexels-photo.jpg" class="img-responsive img-rounded" style="max-height: 40px; margin-top: -15%;"></a>
      </div>

    <div class="navbar-collapse collapse navbar-right">
      <ul class="nav navbar-nav">
        <li><a href="#">HOME</a></li>
        <li><a href="#">LINK</a></li>
        <li><a href="#">LINK</a></li>
        <li><a href="#">LINK</a></li>
        <li><a href="#">LINK</a></li>
      </ul>
   </div>
   </div>
</div>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
Find elsewhere
🌐
GitHub
gist.github.com › tormi › a39b64621a160d1c520dcaf62f02e9bb
Bootstrap 3 Nav Menu Responsive Brand Logo Image · GitHub
There is a bug in Firefox with the bootstrap navbar-brand image. These methods above FIX the firefox issue by applying padding to the image and not the .navbar-brand tag removing the padding on .navbar-brand. If you're looking for my original post using object fit method I have removed it for now because it is not fully supported in IE without a polyfill or fallback using css tables. These are all examples of how to use a logo image in the bootstrap nav using tag.
🌐
SitePoint
sitepoint.com › html & css
Bootstrap 4 navbar-brand with image and text - HTML & CSS - SitePoint Forums | Web Development & Design Community
January 21, 2018 - I am looking for a way to have a navbar-brand with an image and text. This is where I’m after: I was thinking of using the image and a div as inline-blocks like this: <a class="navbar-brand" href="#"> <img id="logo…
🌐
GeeksforGeeks
geeksforgeeks.org › reactjs › how-to-add-a-logo-to-the-react-bootstrap-navbar
How to Add a Logo to the React Bootstrap Navbar ? - GeeksforGeeks
July 23, 2025 - import React from 'react'; import { Navbar, Nav } from 'react-bootstrap'; function App() { const logoUrl = 'https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190710102234/download3.png'; return ( <Navbar bg="dark" expand="lg" variant="dark" className="container-fluid"> <Navbar.Brand href="#home"> <img src={logoUrl} width="50" height="50" alt="Logo" /> <span className="brand-text"> GeeksforGeeks </span> </Navbar.Brand> <Navbar.Toggle aria-controls="basic-navbar-nav" /> <Navbar.Collapse id="basic-navbar-nav"> <Nav className="ml-auto"> <Nav.Link href="#pick"> Pick Article </Nav.Link> <Nav.Link href="#suggest"> Suggest Article </Nav.Link> <Nav.Link href="#write"> Write an Article </Nav.Link> </Nav> </Navbar.Collapse> </Navbar> ); } export default App;
🌐
W3Schools
w3schools.com › bootstrap › bootstrap_navbar.asp
Bootstrap Navigation Bar
This problem (with the small screens) will be solved in the last example on this page. If you don't like the style of the default navigation bar, Bootstrap provides an alternative, black navbar: Just change the .navbar-default class into .navbar-inverse: <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#">WebSiteName</a> </div> <ul class="nav navbar-nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Page 1</a></li> <li><a href="#">Page 2</a></li> <li><a href="#">Page 3</a></li> </ul> </div> </nav> Try it Yourself » ·
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › components › navbar
Navbar · Bootstrap v5.0
You can replace the text within the .navbar-brand with an <img>. <nav class="navbar navbar-light bg-light"> <div class="container"> <a class="navbar-brand" href="#"> <img src="/docs/5.0/assets/brand/bootstrap-logo.svg" alt="" width="30" height="24"> </a> </div> </nav>
🌐
Bootstrap
getbootstrap.com › docs › 5.3 › components › navbar
Navbar · Bootstrap v5.3
You can replace the text within the .navbar-brand with an <img>. ... <nav class="navbar bg-body-tertiary"> <div class="container"> <a class="navbar-brand" href="#"> <img src="/docs/5.3/assets/brand/bootstrap-logo.svg" alt="Bootstrap" width="30" height="24"> </a> </div> </nav>
🌐
React Bootstrap
react-bootstrap.netlify.app › navbars
Navbars | React Bootstrap
A responsive navigation header, including support for branding, navigation, and more. Here’s an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the lg (large) breakpoint. ... A simple flexible branding component. Images are supported but will likely require custom styling to work well. ... Use <Form inline> and your various form controls within the Navbar.
🌐
MDBootstrap
mdbootstrap.com › standard › navbar
Bootstrap Navbar - free examples & tutorial
Documentation and examples for powerful, responsive navigation header - MDB navbar. Includes support for branding, navigation, and more, including support for our collapse plugin. ... A basic example of the navbar with the most common elements like link, search form, brand, and dropdown.
🌐
W3Schools
w3schools.com › bootstrap4 › bootstrap_navbar.asp
Bootstrap 4 Navigation Bar
When using the .navbar-brand class on images, Bootstrap 4 will automatically style the image to fit the navbar vertically. <nav class="navbar navbar-expand-sm bg-dark navbar-dark"> <a class="navbar-brand" href="#"> <img src="bird.jpg" alt="Logo" style="width:40px;"> </a> ... </nav> Try it Yourself » · Very often, especially on small screens, you want to hide the navigation links and replace them with a button that should reveal them when clicked on.
🌐
Bootstrap
getbootstrap.com › docs › 4.0 › components › navbar
Navbar · Bootstrap
Documentation and examples for Bootstrap’s powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin.
🌐
W3Schools
w3schools.com › bootstrap5 › bootstrap_navbar.php
Bootstrap 5 Navigation Bars
<nav class="navbar navbar-expand-sm bg-dark navbar-dark"> <div class="container-fluid"> <a class="navbar-brand" href="#">Logo</a> </div> </nav> Try it Yourself » · When using the .navbar-brand class with images, Bootstrap 5 will automatically style the image to fit the navbar vertically.
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › content › images
Images · Bootstrap v5.0
Documentation and examples for opting images into responsive behavior (so they never become larger than their parent elements) and add lightweight styles to them—all via classes.