A decade of Canvas at your command, powered by our custom AI engineStart building

Bootstrap Spacing Calculator

The Bootstrap Spacing Calculator generates precise Bootstrap 5 spacing utility classes (margin and padding) for any element configuration. Select your property, sides, breakpoint, and size value to instantly get the correct class syntax — no memorizing the m-/p- class naming convention required. Built for frontend developers and designers who work with Bootstrap 5 daily.

Configuration

Spacing Configuration

3

Element Settings

Preview Design

6

How to Use

1. Configure your spacing property (margin or padding), the target sides, and the responsive breakpoint you need. 2. Adjust the spacing size using the range slider (0–5, plus auto for margins), then set your element type and any additional utility classes. 3. Preview the rendered element with live spacing applied so you can visually verify the result. 4. Copy the generated Bootstrap 5 HTML snippet or the class string directly into your project.

Why Use This Tool?

Bootstrap's spacing class naming convention — combining property, side, breakpoint, and size into a single class like 'mb-md-3' — is fast to write once you know it, but error-prone when combining multiple breakpoints or sides. This tool eliminates lookup time and typo-driven layout bugs by generating the exact class string for every configuration. No npm installs, no browser extensions, no signup — just open and use.

Frequently Asked Questions

What is the Bootstrap Spacing Calculator?
It's a free online tool that generates Bootstrap 5 margin and padding utility classes based on your chosen property, side, breakpoint, and size — outputting ready-to-paste HTML with the correct class syntax.
How do Bootstrap 5 spacing sizes map to actual pixel values?
Bootstrap 5 spacing sizes use a scale from 0 to 5 based on a base spacer of 1rem (16px by default). Size 1 = 0.25rem (4px), size 2 = 0.5rem (8px), size 3 = 1rem (16px), size 4 = 1.5rem (24px), size 5 = 3rem (48px). The 'auto' value applies auto margin and is only valid for margin properties. You can override the base spacer in your own Sass variables if you're compiling Bootstrap from source.
Is it free?
Yes — the Bootstrap Spacing Calculator is completely free with no signup required. Built by the CanvasBuilder.co team.