This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The box-sizing property is used to alter the default CSS box model used to calculate width and height of the elements.

/* Keyword values */
box-sizing: content-box;
box-sizing: border-box;

/* Global values */
box-sizing: inherit;
box-sizing: initial;
box-sizing: unset;

You can use this property to emulate the behavior of browsers that do not correctly support the CSS box model specification.

Initial valuecontent-box
Applies toall elements that accept width or height
Computed valueas specified
Animation typediscrete
Canonical orderthe unique non-ambiguous order defined by the formal grammar


The box-sizing property is specified as a single keyword chosen from the list of values below.


This is the initial and default value as specified by the CSS standard. The width and height properties are measured including only the content, but not the padding, border or margin. Note: Padding, border & margin will be outside of the box e.g. IF .box {width: 350px;} THEN you apply {border: 10px solid black;} RESULT {rendered in the browser} a box of width: 370px.
So simply the dimension of element is calculated as, width = width of the content, and height = height of the content (excluding the values of border and padding).
The width and height properties include the content, the padding and border, but not the margin. This is the box model used by Internet Explorer when the document is in Quirks mode. Note that padding and border will be inside of the box e.g.  .box {width: 350px; border: 10px solid black;} leads to a box rendered in the browser of width: 350px. The content box can't be negative and is floored to 0, making it impossible to use border-box to make the element disappear.
Here the dimension is calculated as, width = border + padding + width of the content, and height = border + padding + height of the content.
The width and height properties include the content, the padding but neither the border, nor the margin. Only Firefox implemented this value, and it was removed in Firefox 50.

Formal syntax

content-box | border-box


/* support Firefox, Chrome, Safari, Opera, IE8+ and old Android */

.example {
  -moz-box-sizing: border-box;
  box-sizing: border-box;


Specification Status Comment
CSS Basic User Interface Module Level 3
The definition of 'box-sizing' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 -webkit[1]

1.0 (1.7 or earlier)-moz[1]
29.0 (29.0)[2]


7.0 3.0 (522)-webkit
padding-box No support No support 1.0 (1.7 or earlier)-moz[1]
29.0 (29.0)
Removed in 50.0 (50.0)
No support No support No support
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 2.1-webkit[1]
1.0 (1.0)-moz[1]
29.0 (29.0)[2]
9.0 (Yes) (Yes)
padding-box No support No support 1.0 (1.0)-moz[1]
29.0 (29.0)
Removed in 50.0 (50.0)
No support No support No support

[1] box-sizing is not respected when the height is calculated from window.getComputedStyle(), in Internet Explorer (all versions), in Firefox prior to 23, and in Chrome. Edge doesn't exhibit the problem. Note that IE9's proprietary currentStyle property does return the correct value of height.

[2] In addition to the unprefixed support, Gecko 44.0 (Firefox 44.0 / Thunderbird 44.0 / SeaMonkey 2.41) added support for a -webkit prefixed version of the property for web compatibility reasons behind the preference layout.css.prefixes.webkit, defaulting to false. Since Gecko 49.0 (Firefox 49.0 / Thunderbird 49.0 / SeaMonkey 2.46) the preference defaults to true.

[3] The vendor prefix -webkit was removed in 534.12.

See also