Factorial calculator

This factorial calculator gives n! exactly with every digit, up to n = 5,000. The factorial of 25 has 26 digits and that of 100 has 158 – more than any pocket calculator shows. It also gives trailing zeros, scientific notation and Stirling’s approximation.

Example: What do you want to calculate: Factorial n! · Number n 25 → Result: 25! = 15,511,210,043,330,985,984,000,000. Source: Wikipedia – Factorial (definition, growth, trailing zeros, Stirling). Updated: .

Whole number from 0 to 5,000.
My ToolboxYour inputs are saved in this browser only.

Result

Result
25! = 15,511,210,043,330,985,984,000,000
Number of digits
26 digits
Scientific notation
Scientific: 1.551121 × 10²⁵
Trailing zeros
Trailing zeros: 6 (sum of the integer quotients n ÷ 5, n ÷ 25, n ÷ 125 …)
Stirling’s approximation
Stirling’s approximation: ≈ 1.546 × 10²⁵ (0.33% off)

How it is calculated

How to calculate a factorial

The factorial n! is the product of all whole numbers from 1 to n: n! = 1 · 2 · 3 · … · n. By definition 0! = 1. Examples: 5! = 120, 10! = 3,628,800 and 20! = 2,432,902,008,176,640,000.

Why the numbers grow so fast

Each step multiplies by a larger number. 25! has 26 digits, 70! is 1.198 × 10100 and already exceeds a googol, and 100! has 158 digits. That is why many pocket calculators stop at 69!. This calculator uses integers of arbitrary size (BigInt) and gives every digit exactly.

Trailing zeros and approximation

What factorials are for

They count arrangements: five people can be lined up in 5! = 120 ways. They appear in the formulas of combinatorics (n choose k), in probability and in series expansions.

Honest limits

The calculator handles factorials of whole numbers up to 5,000. The gamma function for decimals and the double factorial are not included. Results longer than 2,000 digits are shown shortened (start and end); the digit count stays exact.

Frequently asked questions

How do I calculate a factorial?

Multiply all whole numbers from 1 to n. 5! = 1 · 2 · 3 · 4 · 5 = 120.

What is 0 factorial?

0! is 1 by definition. That fits the rule n! = n · (n − 1)! and the single way of arranging zero items.

How many digits does 100 factorial have?

158 digits; it starts with 9.33 × 10^157 and ends in 24 zeros.

How do I find a factorial on a calculator?

Use the x! key (on Casio, Shift + x⁻¹). Most devices stop at 69! because 70! is larger than 10^100.

How do I compute a factorial in Python?

math.factorial(n) does it; Python integers have no size limit. With this calculator you see the result without any code.

Sources and legal basis

As of: · Editorial policy

Related tools