Bootstrap 5: Shrink Input Box Size

Ruth Jul 09, 2026

Looking to optimize your Bootstrap 5 layout by reducing the size of input boxes? You're in the right place. In this guide, we'll explore how to shrink input fields in Bootstrap 5, enhancing your web design's aesthetics and responsiveness.

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

Bootstrap 5 offers a range of classes that allow you to control the size of form inputs. By default, Bootstrap 5 uses the 'form-control' class for inputs, which sets a width of 100%. However, you can use additional classes to reduce this width.

Add Bootstrap Glyphicon to Input Box
Add Bootstrap Glyphicon to Input Box

Understanding Bootstrap 5 Input Sizes

Bootstrap 5 provides five predefined sizes for form inputs: extra small (xs), small (sm), default (md), large (lg), and extra large (xl). The default size is 'md', which sets the input width to 100% of its parent element.

Add remove input fields dynamically using jQuery and bootstrap
Add remove input fields dynamically using jQuery and bootstrap

To reduce the size of an input box, you can use the smaller size classes. Let's dive into how to use these classes to shrink your input fields.

Using Smaller Input Sizes

BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP

To reduce the size of an input box, you can use the 'input-group' class along with the desired size class. For example, to create an extra small input, you would use 'input-group input-group-xs'.

Here's a simple example: ```html

```

Customizing Input Width

Understanding Bootstrap 5 Layout
Understanding Bootstrap 5 Layout

If the predefined sizes don't meet your needs, you can also set a custom width using CSS. To do this, you can override the width of the input using the 'width' property. For example: ```html

```

Responsive Input Sizes

Bootstrap 5's input sizes are responsive, meaning they adjust based on the screen size. This ensures that your inputs look good on all devices, from desktops to mobile phones.

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

To understand how this works, let's look at the responsive sizes for each of Bootstrap 5's input sizes: - 'xs': Less than 576px (mobile) - 'sm': Greater than or equal to 576px - 'md': Greater than or equal to 768px (tablet) - 'lg': Greater than or equal to 992px (desktop) - 'xl': Greater than or equal to 1200px (large desktop)

Changing Input Size on Resize

Bootstrap 5 Buttons with Icon and Text Tutorial & Demo — CodeHim
Bootstrap 5 Buttons with Icon and Text Tutorial & Demo — CodeHim
Bootstrap Add Rows To Table
Bootstrap Add Rows To Table
the different types of font and numbers
the different types of font and numbers
Combo Boxes
Combo Boxes
How to Use Bootstrap in HTML | Web Development
How to Use Bootstrap in HTML | Web Development
How to Customize Bootstrap
How to Customize Bootstrap
How To Speed Up Your Bootstrap Development Process
How To Speed Up Your Bootstrap Development Process
What is Bootstrap ? What are the advantages of using Bootstrap ?
What is Bootstrap ? What are the advantages of using Bootstrap ?
Bootstrap Buttons Guide: Examples and Tutorials
Bootstrap Buttons Guide: Examples and Tutorials
40+ Must-have plugins of 2015 for extending Twitter Bootstrap possibilities .
40+ Must-have plugins of 2015 for extending Twitter Bootstrap possibilities .
Bootstrap Responsive Button
Bootstrap Responsive Button
40 Plugins, Addons & Components for the Bootstrap Framework — Speckyboy
40 Plugins, Addons & Components for the Bootstrap Framework — Speckyboy
UI/UX Pro Tip: Add privacy statements to increase form submissions
UI/UX Pro Tip: Add privacy statements to increase form submissions
How to Create Bootstrap Navbar | Responsive Navbar Tutoria
How to Create Bootstrap Navbar | Responsive Navbar Tutoria
an email form with instructions to install and configure the box spaces on it
an email form with instructions to install and configure the box spaces on it
Roundups | AZMIND - Part 4
Roundups | AZMIND - Part 4
Form Inputs: The Browser Support Issue You Didn’t Know You Had — Smashing Magazine
Form Inputs: The Browser Support Issue You Didn’t Know You Had — Smashing Magazine
How can I implement user-friendly boolean logic in a web form GUI?
How can I implement user-friendly boolean logic in a web form GUI?
Free Bootstrap Page Builder with Online Customization
Free Bootstrap Page Builder with Online Customization
GoSnippets — Free Code Snippets for Bootstrap, Tailwind, React, CSS, JavaScript & more
GoSnippets — Free Code Snippets for Bootstrap, Tailwind, React, CSS, JavaScript & more

If you want to change the input size based on the screen size, you can use media queries. For example, to change the input size from 'md' to 'sm' when the screen size is less than 768px, you would use: ```html ```

Remember, the key to effective use of Bootstrap 5's input sizes is to test your design on different devices and screen sizes. This will ensure that your inputs look and function as expected, regardless of where they're viewed.

In the world of web design, every pixel counts. By mastering Bootstrap 5's input sizes, you can create layouts that are not only functional but also visually appealing. So go ahead, experiment with different input sizes, and watch as your web design comes to life.