Search Tools

Flexbox sizing, minimum widths and free-space distribution

Analyze sizing, wrapping and free-space distribution along the main axis of a horizontal Flexbox layout

Calculates main-axis widths in CSS px for normal-flow elements in the row direction. Supply measured content-box widths for intrinsic sizes; text and image widths are not estimated.

Displayed widths are rounded to 6 decimal places. Results may differ from a browser’s pixel distribution and rendering rounding.

Flex items (input order)Required
RowItem name Optionalflex-basisGrowShrinkmin-widthmax-width OptionalLeft margin OptionalRight margin Optionalbox-sizingHorizontal padding + borders (px)Specified width (px) OptionalMeasured min-content (px) OptionalMeasured max-content (px) OptionalScroll containerActions
1
2

Paste 14 tab-separated columns into the leftmost field. Up to 40 rows.

Enter CSS values such as 100px or auto for basis, min, max and margins. Min requires auto or a px length. Blank max means none; blank left/right margins mean 0px. Edge is the total horizontal padding and borders (px). Specified is the CSS width value. Enter separately measured content-box widths for intrinsic sizes.

Results

Results update automatically when the required values are entered.

Report an issue

Method, applicability and sources

Calculation method

Line collection uses each item’s outer hypothetical main size (basis clamped by min/max, plus horizontal padding, borders and margins) and the gap. For each line, the hypothetical total and inner width select grow or shrink. Grow distributes free space in proportion to grow factors; shrink uses shrink × content flex-basis. Items are frozen according to the sign of min/max violations, then remaining space is redistributed. Positive free space after sizing is assigned to auto margins first, with the remainder distributed by justify-content.

Worked example (hypothetical values)

Example: inner width 300px, gap 0, two items with basis 100px, grow factors 1 and 2 and min 0px produce final content widths of 133.333…px and 166.666…px. With inner width 150px, grow 0 and shrink 1 for both items, the widths are 75px and 75px.

Applicability and limitations

Horizontal row layouts with widths specified in px, non-replaced flex items in normal flow, and any required intrinsic widths measured separately. Does not cover column, RTL, reverse or reordered layouts; percentages, em, calc(), aspect-ratio, replaced elements, complex content layout, the cross axis, absolutely positioned elements, scrollbar widths or browser-specific subpixel distribution. Border-box width and basis values must be at least the total horizontal padding and borders.

Method and sources

Method: W3C CSS Flexbox Level 1 CRD 2025-10-14, horizontal px subset v1. Data recorded: 2026-11-14.