CSS Box Model Calculator
Symmetric nonnegative pixel padding/border/margins.
Enabling local controls…
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.
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.