CalculatorSwitch
Calculator Switch
Math

Factorial Calculator

Last updated:

How to Use This Calculator

Step 1: Enter a non-negative integer (0, 1, 2, ..., up to 1000).

Step 2: Click Calculate.

Step 3: See the factorial value, scientific notation, and step-by-step expansion. Very large factorials are computed with arbitrary-precision integers.

What Is a Factorial?

The factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 up to n. For example, 5! = 1 × 2 × 3 × 4 × 5 = 120.

By definition, 0! = 1 and 1! = 1. This might seem odd, but it is the convention that makes the rules of combinatorics work consistently — it's the 'empty product' (a product with no factors is 1, just as an empty sum is 0).

Factorials grow extraordinarily fast. 10! is about 3.6 million. 20! is over 2 quintillion. 100! has 158 digits. By n = 170, factorials exceed what can be represented in standard floating-point numbers — this calculator uses JavaScript BigInt for exact results beyond that point.

The Factorial Formula

n! = 1 × 2 × 3 × ... × n

Recursive definition: n! = n × (n−1)!

Special cases: 0! = 1 and 1! = 1

Example: 5! = 5 × 4 × 3 × 2 × 1 = 120

Related formulas:
Permutations: nPr = n! / (n−r)!
Combinations: nCr = n! / (r! × (n−r)!)

Factorials for Small n

nn!Value
011
111
55!120
1010!3,628,800
1515!1,307,674,368,000
2020!2.43 × 10¹⁸
100100!158 digits

Examples

Example 1: 5! = 1 × 2 × 3 × 4 × 5 = 120 — the number of ways to arrange 5 books on a shelf.

Example 2: 10! = 3,628,800 — possible orders for 10 runners in a race.

Example 3: 52! ≈ 8.07 × 10⁶⁷ — the number of possible orderings of a standard deck of cards (more than the number of atoms in the observable galaxy).

Tips

0! = 1 by convention — this makes combinatorics formulas work.

Factorials explode fast. 20! already exceeds 2 quintillion.

52! is astronomically large — a well-shuffled deck has never been in that exact order before.

Permutations and combinations both use factorials.

Frequently Asked Questions

Why does 0! equal 1?
It is a convention, but one that makes everything else work. The recursive definition n! equals n times (n minus 1)! implies that 1! equals 1 times 0!, so for 1! to equal 1, 0! must also equal 1. In combinatorics, the number of ways to arrange 0 items is exactly 1 (the empty arrangement), which matches 0! equals 1. This convention is what lets the formula for combinations and permutations work consistently even when r equals 0 or r equals n.
What is the factorial of a negative number or fraction?
Negative integers do not have factorials — the factorial function is only defined for non-negative integers in elementary math. For non-integer values, mathematicians use the Gamma function, which extends factorial to all positive real numbers and even complex numbers. The relationship is Gamma(n) equals (n minus 1)!, so Gamma(5) equals 4! equals 24. This calculator handles non-negative integers only; Gamma function evaluation requires specialized software.
Why do factorials grow so quickly?
Each step multiplies by a larger number than the last, so growth accelerates. Factorial grows faster than any exponential function. For example, 2 to the 10 equals 1,024, but 10! equals 3,628,800 — over 3,500 times larger. By n equals 25, the factorial exceeds 10 to the 25. This is why factorials show up whenever you count all possible orderings or combinations — those numbers become astronomically large very quickly.
What are factorials used for in real life?
Factorials count arrangements and are essential to probability, combinatorics, and statistics. The number of ways to arrange n items in order is n!. The number of ways to choose r items from n (order mattering) is n! divided by (n minus r)!. The number of unordered selections is n! divided by (r! times (n minus r)!). Applications include poker hand probabilities, password strength estimates, scheduling problems, genome sequencing, and cryptography.
How large can factorials get before computers fail?
Standard double-precision floating-point numbers (used in most calculators) can represent factorials up to 170! — at 171! the number exceeds the maximum representable double. Beyond that, you need arbitrary-precision integer arithmetic. This calculator uses JavaScript's BigInt for exact results up to 1000!, which has 2,568 digits. Going beyond that requires specialized mathematical software like Wolfram Mathematica or SageMath.
Is 52! really larger than the number of atoms in the galaxy?
Yes. 52 factorial equals approximately 8.07 times 10 to the 67, while the Milky Way galaxy contains roughly 10 to the 67 atoms. This means every time you thoroughly shuffle a deck of cards, you almost certainly produce an ordering that has never existed before in human history — the odds of randomly repeating any previous shuffle are essentially zero. This counter-intuitive fact is one of the most striking illustrations of how fast factorials grow.

Related Calculators

Was this useful?