Boostrap 5: Mastering Input Font Size

Ruth Jul 09, 2026

When it comes to web development, Bootstrap is a game-changer. This powerful CSS framework offers a multitude of pre-defined styles and components, making it a breeze to create responsive and visually appealing websites. One of the most fundamental elements in web design is the humble input field. In Bootstrap 5, you have significant control over the font size of these inputs. Let's delve into how you can manipulate this to suit your design needs.

A Beginner's Guide to the Latest Bootstrap 5 Utilities
A Beginner's Guide to the Latest Bootstrap 5 Utilities

Before we dive into the specifics, let's quickly understand why font size in input fields matters. Consistent font sizes enhance readability and user experience. They also play a crucial role in maintaining a cohesive design across your website. Now, let's explore how Bootstrap 5 allows you to customize the font size of input fields.

What font size does Bootstrap 4 use for their elements? Website Font Size Recommendation
What font size does Bootstrap 4 use for their elements? Website Font Size Recommendation

Default Font Size in Bootstrap 5 Inputs

Bootstrap 5 uses the font-size property set to 1rem (which is equivalent to 16px) for input fields by default. This is inline with the browser's default font size, providing a consistent user experience across different browsers.

the different types of font and numbers
the different types of font and numbers

However, Bootstrap 5 also allows you to easily override this default to fit your design requirements. Let's look at how you can do this.

Changing Font Size with Classes

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

Bootstrap 5 introduces a new set of utility classes for controlling font sizes. These classes can be applied directly to your input fields to change their font size. Here are a few examples:

  • .fs-1 - sets font size to 1.25rem (20px)
  • .fs-2 - sets font size to 1.5rem (24px)
  • .fs-3 - sets font size to 1.75rem (28px)
  • .fs-4 - sets font size to 2rem (32px)
  • .fs-5 - sets font size to 2.25rem (36px)
  • .fs-6 - sets font size to 2.5rem (40px)

To use these classes, simply add them to your input field. For example, <input type="text" class="fs-3"> will set the font size to 1.75rem.

Bootstrap 5 Classes List Cheat Sheet
Bootstrap 5 Classes List Cheat Sheet

Custom Font Sizes with Custom Properties

If the predefined font sizes don't meet your needs, you can use custom properties to set a specific font size. Bootstrap 5 allows you to use the --bs-font-size-* variables to set custom font sizes. Here's how you can do it:

First, define your custom font size in your CSS:

Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes
Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes

--bs-font-size-custom: 1.875rem;

Then, apply this custom font size to your input field:

<input type="text" style="font-size: var(--bs-font-size-custom);">

In this example, the font size is set to 1.875rem (30px).

an image of a block diagram with the words boottrap and bootstrap
an image of a block diagram with the words boottrap and bootstrap
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
HTML Input Types : A Comprehensive Guide
HTML Input Types : A Comprehensive Guide
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Understanding Bootstrap 5 Layout
Understanding Bootstrap 5 Layout
Bootstrap 5 Classes List Cheat Sheet
Bootstrap 5 Classes List Cheat Sheet
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
an orange background with some type of text in the bottom right corner and another type of text below
an orange background with some type of text in the bottom right corner and another type of text below
Bootstrap 4 Classes List Cheat Sheet
Bootstrap 4 Classes List Cheat Sheet
INPUT TYPES IN HTML 👌  #THETA
INPUT TYPES IN HTML 👌 #THETA
HTML Input Types – Complete Guide for Beginners
HTML Input Types – Complete Guide for Beginners
📝 Create Text Input Forms and Submit Button in HTML
📝 Create Text Input Forms and Submit Button in HTML
a piece of paper with some writing on it
a piece of paper with some writing on it
Bootstrap 5 Buttons with Icon and Text Tutorial & Demo — CodeHim
Bootstrap 5 Buttons with Icon and Text Tutorial & Demo — CodeHim
an image of a web page with different colors and font on the bottom, including two separate
an image of a web page with different colors and font on the bottom, including two separate
Stop Googling HTML Inputs—Save This Instead!
Stop Googling HTML Inputs—Save This Instead!
Bootstrap Navbar Guide and Free Navigation Examples
Bootstrap Navbar Guide and Free Navigation Examples

Responsive Font Sizes

Bootstrap 5 also supports responsive font sizes. You can use the fs-* classes along with the responsive variants (like sm, md, lg, xl) to change the font size based on the viewport size.

For example, <input type="text" class="fs-3 sm:fs-4"> will set the font size to 1.75rem (28px) on screens smaller than the small breakpoint, and 2rem (32px) on screens larger than or equal to the small breakpoint.

Using the font-size utility class

Another way to control responsive font sizes is by using the font-size-* utility classes. These classes apply the specified font size only at the given breakpoint. For example, <input type="text" class="font-size-lg-3"> will set the font size to 1.75rem (28px) only on screens larger than or equal to the large breakpoint.

In conclusion, Bootstrap 5 offers a wide range of options for controlling the font size of input fields. Whether you're using predefined classes or custom properties, you can easily achieve the perfect font size for your input fields. So, go ahead and experiment with these options to create stunning, responsive web designs.