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: .
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
- Trailing zeros: each zero at the end comes from a factor pair 2 · 5. There are ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … of them; 100! ends in 24 zeros.
- Stirling’s approximation: n! ≈ √(2πn) · (n/e)n. The relative error is about 1 ÷ (12n), roughly 0.83% at n = 10.
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
- Wikipedia – Factorial (definition, growth, trailing zeros, Stirling)
- Wikipedia – Stirling’s approximation (n! ≈ √(2πn)·(n/e)^n)
- MDN – BigInt (Ganzzahlen beliebiger Größe in JavaScript)
As of: · Editorial policy
Related tools
- Combination CalculatorCombination calculator for nCr and nPr, with or without repetition: exact results even for huge numbers, the formula, working and all four cases side by side.
- Exponent calculator with stepsCalculate powers, nth roots and logarithms with any base – step-by-step, with negative and fractional exponents, ln, log and scientific notation.
- Scientific Notation Converter with StepsConvert numbers to and from scientific notation: a × 10ⁿ, E notation, engineering notation with SI prefixes and standard form – exact, step by step.
- Scientific CalculatorFree online scientific calculator: sin, cos, tan in degrees or radians, log, ln, roots, powers, factorial and nCr – with step-by-step working and history.
- Gamma function calculatorGamma function calculator for real numbers: Γ(x) to ten digits, the factorial x! = Γ(x+1), ln Γ(x) and 1/Γ(x), also for negative and very large x.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- Interactive Periodic Table of the ElementsPeriodic table with all 118 elements: atomic mass, electron configuration, melting and boiling point. Search, temperature slider, colour modes, print to PDF.
- Population growth rate calculatorPopulation growth rate calculator: average annual growth rate between two counts, a projection for later years and the doubling time, geometric or exponential.
- E=mc2 calculatorE=mc2 calculator: turn a mass into energy in joules, kWh, MeV and tons of TNT, or find the mass of an energy – with c = 299,792,458 m/s exactly.