ForHosting KIT · Math

Binomial coefficient calculator

A committee of 3 chosen from 10 candidates can be formed in 120 ways: enter n and k and get the exact binomial coefficient, every digit correct and with no rounding. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N
10
K
3
You get
Value
120

The binomial coefficient tells you how many different groups of k items can be selected from n distinct items when selection order does not matter. This calculator accepts non-negative integers n and k, checks that k does not exceed n, and returns the exact value of n choose k as a decimal string. It uses deterministic integer arithmetic rather than floating-point approximations, making the result suitable for combinatorics exercises, probability calculations, software tests, and automated data workflows where every digit must remain correct.

Understand what the binomial coefficient counts

A binomial coefficient counts unordered selections. Imagine that a committee of three people must be selected from ten candidates. Choosing Ana, Ben, and Chen describes the same committee regardless of the order in which their names were picked, so those orderings must not be counted separately.

The answer is written C(10,3), as ten choose three, or with ten above three in bracket notation. In general, C(n,k) equals n factorial divided by k factorial times the factorial of n minus k. The same numbers appear throughout Pascal's triangle and in the coefficients of a binomial expansion such as (x + y) raised to a non-negative integer power.

Important edge cases follow naturally from the definition: choosing nothing from n items has one outcome, choosing all n items also has one outcome, and choosing one item has n outcomes. This capability uses that standard finite counting interpretation. It requires zero or positive integer indexes and rejects k greater than n instead of silently applying a different generalized convention.

The returned value is therefore a dependable count that matches ordinary combinatorics, introductory probability, and discrete mathematics usage.

Provide valid n and k inputs and read the result

Send an object containing the required fields n and k. The field n is the total number of distinct available items, while k is the number selected. Both values must be whole, non-negative integers, n must be no greater than ten thousand, and k must be no greater than n.

Canonical decimal integer strings are also accepted, which is useful when input originates in a text form, but signs, fractions, exponential notation, blank strings, booleans, infinities, and other non-integer values are rejected. A successful response repeats the normalized numeric n and k and supplies value as an exact decimal string. Keep value as text when transporting or storing it, or convert it with a multiprecision integer facility in your programming language.

Use exact computation efficiently and correctly

The implementation does not calculate three enormous factorials and then divide them. Instead, it uses the equivalent multiplicative formula and the symmetry C(n,k) = C(n,n-k). That symmetry means the loop needs only the smaller of k and n minus k steps.

Each step multiplies and divides exact BigInt values, so there is no floating-point rounding, random sampling, or platform-dependent estimate. When applying the result to a binomial probability, multiply the coefficient by the appropriate powers of the success and failure probabilities in a separate step; this capability deliberately returns the exact combinatorial factor only. Do not use it for permutations, because permutations treat different selection orders as different outcomes and use a different formula.

Also avoid converting a large returned value to an ordinary floating-point number merely for convenience, since that would discard the precision the calculator preserves. For repeated calculations with the same n, callers can request each needed k independently, while local specialized software may be more efficient if an application needs millions of coefficients or indexes beyond the published bound.

Check combinatorics exercises

Verify hand calculations for selecting committees, cards, teams, or subsets with an exact and reproducible n choose k value.

Build probability calculations

Obtain the exact combinatorial multiplier needed for binomial probabilities before applying success and failure probability terms.

What does n choose k mean?

It is the number of ways to select k items from n distinct items when order does not matter.

Are zero values supported?

Yes. C(0,0) is 1, and C(n,0) is 1 for every supported non-negative n.

How do I calculate the binomial coefficient?

Divide n factorial by k factorial times (n − k) factorial. For a committee of 3 chosen from 10 candidates, C(10,3) is 10! / (3! · 7!), which gives 120 different committees.

What happens if k is larger than n?

The calculator refuses the input instead of applying another convention, because you cannot pick more items than you have. Check that k, the number chosen, is no greater than n, the total.

How large can n be?

Up to 10,000. The result is exact to the last digit, with no rounding, even when the number is very large, so it suits probability, combinatorics exercises and any check where every figure matters.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/algebra/binomial-coefficient

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/algebra/binomial-coefficient \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":10,"k":3}'
{
  "n": 10,
  "k": 3
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.binomial_coefficient",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_n10000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Provide valid n and k inputs and read the result

The string representation is intentional: many binomial coefficients exceed JavaScript's safe integer range even when their indexes are fairly modest, and forcing such a result into a JSON number would silently change its final digits. Invalid requests produce the standard invalid_input error with a useful message identifying the violated rule. Each successful API request costs $0.002; the calculation performs no network call and does not depend on changing external data.

Create reliable software fixtures

Generate precise expected coefficients for unit tests without depending on floating-point factorial implementations or external services.

Why is value returned as a string?

Binomial coefficients can exceed the exact range of JSON numbers. A decimal string preserves every digit.

What happens when k is greater than n?

The request is rejected with invalid_input because this calculator requires zero less than or equal to k less than or equal to n.

How much does an API calculation cost?

Each successful API request costs $0.002. The browser version can run the same deterministic calculation locally.

Read the full KIT documentation →