← All tools

CSS Box Model Calculator

Symmetric nonnegative pixel padding/border/margins.

css-box-model-calculatorLOCAL WORKSPACE

Enabling local controls…

Local processing inputs

Local Worker: 10s startup, 1s processing. 32KiB per field, 1MiB complete result. Editing or clearing cancels work and stale output. Generated HTML/CSS is not mounted; remote image preview requires a separate action.

Preview and code

Edit fields and build a preview; complete code can be copied or downloaded.

Model and scope

Symmetric nonnegative pixel padding/border/margins. Compute content, used border box and margin box; border-box used size cannot be smaller than padding plus borders. No min/max sizing, flex/grid shrinkage, margin collapse, scrollbars or transforms. Preview scales the result to fit.

CSS Box Sizing ↗ToolHub source controls ↗

How to use this tool

Edit the bounded fields, process locally, inspect the native preview, then copy or download complete code. Editing clears stale output.

When not to use it

Symmetric nonnegative pixel padding/border/margins. Compute content, used border box and margin box; border-box used size cannot be smaller than padding plus borders. No min/max sizing, flex/grid shrinkage, margin collapse, scrollbars or transforms. Preview scales the result to fit.