Calculators

Stars and Bars Calculator

Count exact distributions of identical items into distinct groups, allowing empty groups or requiring at least one item each.

Distribute identical items among distinct groups. Enter 0–10000 items and 1–10000 groups. There is no upper capacity per group. Calculations stay in your browser.

Enter items and groups to count distributions.

Count distributions with stars and bars.

For n identical items and k distinct groups, allowing zero items in a group gives C(n + k − 1, k − 1) distributions. Requiring at least one item in each group gives C(n − 1, k − 1) when n ≥ k, and zero otherwise. For 5 items and 3 groups these counts are 21 and 6. Stars represent items and k − 1 bars separate the labeled groups. Order within a group does not matter, but exchanging group totals can give a different distribution. Zero items have one distribution when empty groups are allowed. One group always has one distribution unless a positive minimum cannot be met. This method assumes identical items, distinct groups and no upper capacity constraints. It does not count assignments of individually distinguishable items. Enter 0 to 10000 items and 1 to 10000 groups as decimal integers; leading zeros and surrounding whitespace are accepted. Exact BigInt arithmetic preserves every result digit. Inputs and results remain in your browser.

Frequently Asked Questions

Everything you need to know about this tool, how it works, and privacy.

What does stars and bars count?

It counts distributions of identical items among distinct groups without upper capacities. With n items and k groups, allowing empty groups gives C(n + k − 1, k − 1).

What if every group needs an item?

Select the minimum-one option. The count is C(n − 1, k − 1) if n is at least k; otherwise it is zero. Five items into three nonempty groups give six distributions.

Can I use distinguishable items or group capacities?

No. These formulas assume identical items and no upper limit per group. Distinguishable items and bounded capacities require different counting methods.

Are large results exact and private?

Yes. The calculator uses browser BigInt arithmetic for exact whole-number results with up to 10000 items and 10000 groups. Nothing is uploaded.