Factorial, Permutation & Combination Calculator

Work out n!, arrangements, combinations and anagram counts exactly, with every step shown in your browser.

How to use

  1. Choose what you need: n!, an arrangement A(n, p), a combination C(n, p), or the anagrams of a word.
  2. Type the numbers — or the word itself, such as BANANA — and the answer updates as you type.
  3. Read the lines under the result to see exactly which factorials were multiplied and divided. Nothing is sent anywhere.

About this tool

A factorial counts the ways to line things up: 5! = 5 × 4 × 3 × 2 × 1 = 120, so five books fit on a shelf in 120 different orders. From there combinatorics splits in two. An arrangement — A(n, p), also called a permutation of p items taken from n — counts ordered selections: A(5, 2) = 20 ways to pick a first and a second place among five runners. A combination — C(n, p) — counts the same selections when the order is irrelevant: C(10, 3) = 120 ways to form a committee of three out of ten people. The only difference between the two is whether swapping two chosen items produces a new outcome.

The arithmetic is done with BigInt, so the results are exact whole numbers instead of rounded floating-point values. That matters quickly: an ordinary JavaScript number stops representing factorials exactly at 171!, which simply becomes infinity, while here 100! is printed in full with all 158 of its digits. Combinations are not computed by dividing three enormous factorials either — the tool multiplies and divides step by step, keeping the intermediate values small and still landing on an exact integer. For permutations with repetition you can type a word instead of numbers: BANANA has six letters with A three times and N twice, so the count is 6! ÷ (3! × 2! × 1!) = 60, because swapping two identical letters does not create a new anagram.

These three formulas cover most of what school and entrance exams ask about counting, and a fair amount of everyday probability. Lottery odds are a combination: choosing 6 numbers out of 60 gives C(60, 6) possible tickets. A hand of five cards from a 52-card deck is C(52, 5) = 2,598,960. Podium finishes, seating plans, password strength and the number of ways a schedule can be built are arrangements. Anagram counts show up in word games and in probability questions about repeated letters. Everything is computed in JavaScript on your device — the numbers you type are never sent to a server, stored or logged.

The formula

n! = n × (n − 1) × … × 2 × 1, with 0! = 1. Arrangements: A(n, p) = n! ÷ (n − p)!. Combinations: C(n, p) = n! ÷ (p! × (n − p)!). Permutations with repetition: P(n; a, b, …) = n! ÷ (a! × b! × …), where a, b, … are how many times each repeated item appears.

Frequently asked questions

What is the difference between an arrangement and a combination?

Order. An arrangement counts ordered selections, so first-then-second is a different outcome from second-then-first; a combination counts only the group that was chosen. That is why A(n, p) is always exactly p! times larger than C(n, p).

Why is 0! equal to 1?

Because there is exactly one way to arrange nothing at all — the empty arrangement. Defining 0! = 1 is also what keeps the combination formula working at its edges, since C(n, 0) and C(n, n) must both equal 1.

How many anagrams does the word BANANA have?

60. The word has six letters, but A repeats three times and N twice, so the 720 arrangements of six distinct letters are divided by 3! × 2! × 1! = 12.

How large can n be?

Up to 1,000. Factorials are shown in full up to 100!, which has 158 digits; above that the exact value is still computed, but only the first and last 24 digits are displayed along with the total digit count.

Do my numbers leave my browser?

No. Every calculation runs in JavaScript on your device, with no requests to any server and nothing stored.

Related tools

Long links? Shorten them for free

Vai.la turns any URL into a short link with click statistics, QR Code and your own biolink.

Vai.la is not responsible for how the tools are used or for decisions made based on their results.