The factorial calculator above multiplies a whole number by every positive whole number below it, all the way down to 1, and returns the exact product β no matter how large the number gets. Factorials show up constantly in probability, statistics, combinatorics, and computer science, yet the arithmetic gets unwieldy fast: 10! is already over three and a half million, and 20! has eighteen digits. This tool does the multiplication for you, shows the full expansion so you can see exactly how the result was built, and also converts your inputs into permutations (nPr) and combinations (nCr) β the two calculations that lean on factorials the most.
Arb Digital built this factorial calculator as part of a free library of study and reference tools. Whether you're checking homework, prepping for a statistics exam, or writing code that needs a quick sanity check on a combinatorics formula, this page gives you the answer and the reasoning behind it in one place.
What This Factorial Calculator Does
Enter any non-negative whole number n and the calculator returns n! β read aloud as "n factorial" β which is defined as the product of every integer from n down to 1. For n = 5, that means 5 Γ 4 Γ 3 Γ 2 Γ 1 = 120. The calculator also accepts a second value, r, which it uses to compute two closely related quantities: nPr, the number of ways to arrange r items chosen from n in a specific order, and nCr, the number of ways to choose r items from n when order doesn't matter. Together, these three numbers cover the vast majority of factorial-based questions you'll encounter in a classroom or a real project.
Small factorials are shown with their full multiplication chain expanded, so you can verify each step by hand if you want to. Larger factorials switch to a compact summary because writing out 50! term by term would take an entire page, but the underlying arithmetic is still exact β this tool uses JavaScript's native BigInt type internally for large values so you get the precise integer answer rather than a rounded floating-point approximation.
How to Use It
- Type your value of n. This is the number you want the factorial of. It must be a whole number that is zero or positive β factorials aren't defined for negative numbers or fractions.
- Type a value of r (optional). If you also need permutations or combinations, enter how many items you're selecting or arranging. r must be less than or equal to n.
- Pick how far to expand. The dropdown controls the cutoff for showing the full step-by-step multiplication. Beyond that point, showing every term becomes impractical, so the tool switches to a summarized digit count instead.
- Click Calculate. The headline result shows n! exactly, the sub-line shows the expansion (or a note that it's too large to expand), and the four boxes below show nPr, nCr, the number of digits in n!, and r! for reference.
- Read the digit count. If you're curious just how fast factorials grow, the "Digits in n!" box is a quick way to see it β 20! already has 19 digits, and 100! has 158.
The Formula: How Factorials Are Calculated
The factorial of a non-negative integer n, written n!, is defined recursively: 0! = 1, and for any n greater than 0, n! = n Γ (n β 1)!. Unrolled, that recursion becomes the familiar product form: n! = n Γ (n β 1) Γ (n β 2) Γ β¦ Γ 2 Γ 1. So 6! = 6 Γ 5 Γ 4 Γ 3 Γ 2 Γ 1 = 720, and 7! = 7 Γ 6! = 7 Γ 720 = 5,040. Each factorial builds directly on the one before it, which is exactly how this calculator computes the result internally β it multiplies iteratively rather than recalculating from scratch every time. For a deeper mathematical treatment of factorials and their properties, Wolfram MathWorld's factorial entry is an excellent authoritative reference.
One rule trips people up every time: 0! = 1, not 0. It feels counterintuitive at first, but it makes sense once you think about what a factorial actually counts: the number of ways to arrange a set of items in order. There is exactly one way to arrange zero items β the empty arrangement β so 0! = 1 keeps every formula that depends on factorials, including combination and permutation formulas, consistent at the edges. If 0! were defined as 0, formulas like nC0 (choosing zero items from n) would break, since nC0 = n! / (0! Γ n!) needs to equal exactly 1, and dividing by zero would make that impossible.
Permutations (nPr) and Combinations (nCr) Explained
Once you understand factorials, permutations and combinations are just two different ways of dividing them. A permutation counts arrangements where order matters β first place, second place, third place β while a combination counts selections where order doesn't matter β just who made the group. Both formulas start from the same idea: take n!, then remove the arrangements you don't want to count.
The permutation formula is nPr = n! / (n β r)!. Picture choosing a president, vice-president, and treasurer from 10 club members: order matters here because each role is different, so you'd compute 10P3 = 10! / 7! = 10 Γ 9 Γ 8 = 720 possible ways to fill the three roles. The (n β r)! in the denominator exists specifically to cancel out the tail of the factorial you don't need β you only care about the first r terms of the n! expansion.
The combination formula adds one more step: nCr = n! / (r! Γ (n β r)!). Now imagine choosing 3 people from the same 10-member club to form a committee, where no role is assigned β just who's on the committee. Order no longer matters, so 3 people chosen as {Alice, Bob, Carla} is the same group as {Carla, Alice, Bob}. Dividing by r! removes all r! ways of reordering the same group, leaving 10C3 = 10! / (3! Γ 7!) = 720 / 6 = 120 distinct committees. Notice that nCr is always nPr divided by r! β the relationship between the two formulas is direct and easy to remember once you've seen it worked through with real numbers.
Why Factorials Grow So Fast β and Why BigInt Matters
Factorials are famous for exploding in size almost as soon as n gets past single digits. 10! is 3,628,800. 15! is already over a trillion. 20! is 2,432,902,008,176,640,000 β more than 2.4 quintillion. This rapid growth is why factorials appear in complexity analysis in computer science: an algorithm that runs in "factorial time" becomes computationally infeasible almost immediately, which is a key reason combinatorics problems (like the traveling salesman problem) are considered hard to brute-force.
It also creates a real technical problem for calculators: standard floating-point numbers in JavaScript (and most programming languages) start losing exact precision once the value exceeds about 2^53, which happens somewhere around 18!. Past that point, a naive calculator will quietly round the last few digits and give you a wrong answer without any warning. This tool avoids that trap by switching to JavaScript's BigInt type for larger inputs, which stores arbitrarily large integers exactly, digit for digit, with no rounding at all. That's why you can safely compute something like 50! or 100! here and get the precise value rather than an approximation β mathematicians sometimes use Stirling's approximation to estimate very large factorials quickly, but this calculator always gives you the exact integer instead of an estimate.
Real-World Uses for Factorials, Permutations, and Combinations
These aren't just abstract classroom exercises. Combinations show up every time you calculate lottery odds β a 6-number lottery drawn from 49 balls has 49C6 possible combinations, which is why the odds of winning are so long. Permutations matter in password and PIN analysis, where the order of characters changes the outcome. Statisticians use both constantly when computing binomial probabilities, and factorials themselves appear in the Taylor series expansions used throughout calculus and physics, in the denominators of terms like x^n / n!.
Scheduling problems lean on permutations too β if you're arranging 8 speakers into a conference agenda, there are 8! = 40,320 possible orderings, which is exactly why event planners use software rather than trial and error. Card games are a classic combinations example: the number of distinct 5-card poker hands from a 52-card deck is 52C5 = 2,598,960, a number that underlies every poker probability table you'll ever see.
- Lottery and raffle odds calculations (combinations)
- Password and PIN strength estimates (permutations)
- Card game and dice probability tables (both)
- Scheduling and seating arrangement problems (permutations)
- Binomial probability and statistics coursework (both, plus factorials directly)
Arb Digital builds fast, high-converting websites and content β from calculators like this one to full marketing sites. If you want a similar interactive tool built for your business, reach out.
Talk to Arb Digital All Free ToolsCommon Mistakes to Avoid
- Forgetting 0! = 1. It's not zero β treating it as zero breaks nCr and nPr formulas at the edges.
- Mixing up nPr and nCr. If the order of the selection changes the outcome (first/second/third place), use permutations. If it doesn't (just picking a group), use combinations.
- Assuming r can exceed n. You cannot choose or arrange more items than exist in the original set β nPr and nCr are undefined when r > n.
- Losing precision on large factorials. Standard calculators and spreadsheet formulas can silently round factorials above roughly 18! β always double-check large results with a tool that uses exact integer arithmetic.
- Treating negative numbers as valid input. Factorials are only defined for non-negative integers in this elementary sense; fractional/negative extensions require the Gamma function, a separate and more advanced topic.
Related Free Tools From Arb Digital
Pair this factorial calculator with the Prime Number Checker to explore number theory further, or the LCM & GCF Calculator for factor-based problems. If your work involves rounding and precision, try the Significant Figures Calculator, and for probability questions built on combinations, the Probability Calculator is a natural next step. You can also use the Fraction Calculator or the Mean, Median & Mode Calculator for related statistics work, or browse our full free online tools hub for more.
Frequently Asked Questions
n! (read "n factorial") means multiplying every whole number from n down to 1. For example, 5! = 5 Γ 4 Γ 3 Γ 2 Γ 1 = 120. It counts the number of ways to arrange n distinct items in order.
By definition, a factorial counts the number of ways to arrange a set of items, and there is exactly one way to arrange an empty set β doing nothing. Defining 0! as 1 also keeps combination and permutation formulas consistent when r equals 0 or n.
nPr (permutations) counts arrangements where order matters, using the formula n! / (n β r)!. nCr (combinations) counts selections where order doesn't matter, using n! / (r! Γ (n β r)!). nCr is always nPr divided by r!.
Standard floating-point numbers in JavaScript and many other languages lose exact integer precision above 2^53, which corresponds to roughly 18!. This calculator uses BigInt arithmetic for larger values so results stay exact rather than rounded.
Not with the standard definition used here, which only applies to non-negative whole numbers. Extending factorials to fractional or negative values requires the Gamma function, a more advanced calculus topic beyond simple multiplication.
Factorials underpin combinations and permutations, which are used to calculate lottery odds, card game probabilities, password combinations, scheduling arrangements, and binomial probability formulas in statistics.
This tool runs entirely in your browser using built-in JavaScript. Nothing you enter is uploaded, stored, or sent to any server.