← All text tools

Flex Grow and Shrink Calculator

Enter container width and each item's flex-basis, grow, shrink, minimum and maximum to see the exact final widths and the step-by-step free-space distribution.

  • Free
  • No sign-up
  • Works on any device

About Flex Grow and Shrink Calculator

When flex items do not fit a container, CSS shrinks them in proportion to flex-shrink times flex-basis, not equally. This calculator follows the Flexible Box algorithm, with frozen items, minimum and maximum clamps and repeated rounds, and shows each step. In the example a 500 px container holds items of 200, 300 and 100 px, where the last cannot shrink. The 100 px of overflow is shared by A and B in the ratio 200 to 300, so A becomes 160 px and B 240 px. You also get the flex shorthand for each item.

How to use Flex Grow and Shrink Calculator

  1. Enter the container width and the gap between items.
  2. Add one item per line: name, flex-basis, grow, shrink, and optionally a minimum and maximum width.
  3. Read the final widths and the round-by-round explanation, then copy the CSS.

Why use this tool?

Also known as

Frequently asked questions

Why is my item shrinking less than I expected?

Shrink is weighted by the item's flex-basis, so larger items give up more space. An item with flex-shrink 0, or one that has reached its minimum width, takes no part in the sharing.

Why do browsers sometimes show different widths?

Real browsers apply min-width: auto, which stops an item shrinking below its content size, and add padding and borders. Here a missing minimum counts as 0 and sizes are outer sizes, so set a minimum yourself to match.

What happens when the factors add up to less than 1?

Then only that fraction of the free space is distributed, as the specification says, so the items may not fill the container completely.

Is Flex Grow and Shrink Calculator free?

Yes. Flex Grow and Shrink Calculator on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

Can I put Flex Grow and Shrink Calculator on my own website?

Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.