Bootstrap Badges

Documentation and examples for badges, our small count and labeling component.

Bootstrap badge examples

Bootstrap badge examples with Torus Kit enhancements such as custom badge color , outline badge style, or even circle badge with custom colored shadows .

Secondary badge New
Light badge Sale!
Outline badge 50%
Circle badge 50%


Badges scale to match the size of the immediate parent element by using relative font sizing and em units. As of v5, badges no longer have focus or hover styles for links.

Example heading New

Example heading New

Example heading New

Example heading New

Example heading New
Example heading New
<h1>Example heading <span class="badge bg-secondary">New</span></h1>
<h2>Example heading <span class="badge bg-secondary">New</span></h2>
<h3>Example heading <span class="badge bg-secondary">New</span></h3>
<h4>Example heading <span class="badge bg-secondary">New</span></h4>
<h5>Example heading <span class="badge bg-secondary">New</span></h5>
<h6>Example heading <span class="badge bg-secondary">New</span></h6>

Badges can be used as part of links or buttons to provide a counter.

<button type="button" class="btn btn-primary">
Notifications <span class="badge bg-primary bg-darken-xl">4</span>

Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.

Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.

<button type="button" class="btn btn-primary">
Profile <span class="badge bg-primary bg-darken-xl">9</span>
<span class="visually-hidden">unread messages</span>

Background colors

Use our background utility classes to quickly change the appearance of a badge. Please note that when using Bootstrap’s default .bg-light, you’ll likely need a text color utility like .text-dark for proper styling. This is because background utilities do not set anything but background-color.

<span class="badge bg-primary">Primary</span>
<span class="badge bg-secondary">Secondary</span>
<span class="badge bg-success">Success</span>
<span class="badge bg-info text-dark">Info</span>
<span class="badge bg-warning text-dark">Warning</span>
<span class="badge bg-danger">Danger</span>
<span class="badge bg-light text-dark">Light</span>
<span class="badge bg-dark">Dark</span>
<span class="badge bg-gray">Gray</span>
Conveying meaning to assistive technologies

Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .visually-hidden class.

Badge styles

Extended colors

If $enable-extended-color-palette variable is set to true, you can use new .bg-* utilities for creating new Bootstrap badge styles.

<span class="badge bg-blue">Blue</span>
<span class="badge bg-indigo">Indigo</span>
<span class="badge bg-navy">Navy</span>
<span class="badge bg-maroon">Maroon</span>
<span class="badge bg-brown">Brown</span>
<span class="badge bg-purple">Purple</span>
<span class="badge bg-pink">Pink</span>
<span class="badge bg-magenta">Magenta</span>
<span class="badge bg-red">Red</span>
<span class="badge bg-orange">Orange</span>
<span class="badge bg-yellow">Yellow</span>
<span class="badge bg-lime">Lime</span>
<span class="badge bg-green">Green</span>
<span class="badge bg-teal">Teal</span>
<span class="badge bg-cyan">Cyan</span>
<span class="badge bg-black">Black</span>
<span class="badge bg-gray">Gray</span>

Color shading

Create custom badge with custom background color by using bg-{darken|lighten}-* shading class, .bg-alpha-* to change the background alpha channel and .text-{color} to set the font color.

<span class="badge bg-primary bg-darken-xl">Primary</span>
<span class="badge bg-primary bg-lighten-md">Primary</span>
<span class="badge bg-danger bg-lighten-xl text-danger">Danger</span>
<span class="badge bg-black bg-opacity-60">Black</span>

Outline badge

To create an outline bordered badge, just add a .badge-outline class and set text color with .text-* utility. Border will be automatically colorized thanks to currentColor property.

<span class="badge badge-outline text-primary">Primary</span>
<span class="badge badge-outline text-secondary">Secondary</span>
<span class="badge badge-outline text-success">Success</span>
<span class="badge badge-outline text-info">Info</span>
<span class="badge badge-outline text-warning">Warning</span>
<span class="badge badge-outline text-danger">Danger</span>
<span class="badge badge-outline text-light">Light</span>
<span class="badge badge-outline text-dark">Dark</span>
<span class="badge badge-outline text-gray">Gray</span>

Custom color

You’re not limited to use just predefined colors. Add your own custom CSS color using data-tor="bg(<color>)", data-tor="border(<color>)" or data-tor="text(<color>)" attributes. You can even use CSS variables!

<span class="badge" data-tor="bg(#269389)">#269389</span>
<span class="badge" data-tor="bg(rgba(0,55,210,.8))">rgba(0,55,210,.8)</span>
<span class="badge" data-tor="bg(--tor-danger)">--tor-danger</span>
<span class="badge" data-tor="border(#269389) bg(rgba(38, 147, 137, .1)) text(--bs-success)">custom</span>

Pill badges

Use the .rounded-pill utility class to make badges more rounded with a larger border-radius.

<span class="badge rounded-pill bg-primary">Primary</span>
<span class="badge rounded-pill bg-secondary">Secondary</span>
<span class="badge rounded-pill bg-success">Success</span>
<span class="badge rounded-pill bg-info text-dark">Info</span>
<span class="badge rounded-pill bg-warning text-dark">Warning</span>
<span class="badge rounded-pill bg-danger">Danger</span>
<span class="badge rounded-pill bg-light text-dark">Light</span>
<span class="badge rounded-pill bg-dark">Dark</span>
<span class="badge rounded-pill bg-gray">Gray</span>

Circle badges

Create circle badges by adding .circle class with appropriate sizing and wrap the inner content into <span>. Read more in Shapes.

<span class="badge circle circle-md bg-primary mr-2"><span>Primary</span></span>
<span class="badge circle circle-md bg-secondary mr-2"><span>Secondary</span></span>
<span class="badge circle circle-md bg-success mr-2"><span>Success</span></span>
<span class="badge circle circle-md bg-info mr-2"><span>Info</span></span>
<span class="badge circle circle-md bg-warning text-dark mr-2"><span>Warning</span></span>
<span class="badge circle circle-md bg-danger mr-2"><span>Danger</span></span>
<span class="badge circle circle-md bg-light text-dark mr-2"><span>Light</span></span>
<span class="badge circle circle-md bg-dark mr-2"><span>Dark</span></span>
<span class="badge circle circle-md bg-gray mr-2"><span>Gray</span></span>

Notification style

Using .circle class mentioned above, you can create notification-like badge with minimum code. This example uses Shapes component and Position utility.

<button class="btn btn-outline-secondary position-relative">
<span class="circle d-flex bg-danger text-white p-3 shadow position-absolute" data-tor="place.right shift.up(50%) shift.right(50%)">
<span class="small">12</span>