Free online tools

CSS Box Model Calculator

See how content-box and border-box affect the physical space a card or control occupies.

Enter your values

This tool processes your input in your browser.

Result

Read width and height with the chosen sizing rule

In content-box, width and height describe the inner content. Padding and border are added outside. In border-box, width and height include padding and border and leave the remainder for content.

Include margin when planning surrounding space

The outer figures add the same margin on both sides. Actual block margins can collapse, and layout constraints can affect sizes; this calculation describes a single box’s dimensions.

Frequently asked questions

Can padding make the content box negative?

No. The inner content dimensions stop at zero. Very large padding or borders can require a border box larger than the requested dimensions.