Factorial Calculator
n! computed exactly with big integers up to 1000, in scientific notation beyond, plus the digit count, trailing zeros and the gamma function for non-integers.
Factorial Calculator: with the default inputs, n! is 3,628,800.
Whole numbers give n!. Non-integers are evaluated as Γ(n + 1), the smooth extension of the factorial.
- Number of digits
- 7Whole-number inputs only.
- log₁₀(n!)
- 6.559763
- Trailing zeros
- 2How many zeros n! ends in — Legendre's formula.
- As an ordinary number
- 3,628,800Blank above 170!, which overflows double precision.
Assumptions
- Whole-number inputs up to 1000 are exact (arbitrary-precision integers); above that the value is derived from log Γ(n + 1).
- Non-integer inputs are evaluated as Γ(n + 1) with the Lanczos approximation (g = 7, 9 terms, relative error ≈ 1e-15).
- Negative whole numbers are rejected because gamma has poles there.
- The ordinary-number output is blank above 170!, the double-precision overflow point.
| n | n! | Digits |
|---|---|---|
| 0 | 1 | 1 |
| 1 | 1 | 1 |
| 2 | 2 | 1 |
| 3 | 6 | 1 |
| 4 | 24 | 2 |
| 5 | 120 | 3 |
| 6 | 720 | 3 |
| 7 | 5,040 | 4 |
| 8 | 40,320 | 5 |
| 9 | 362,880 | 6 |
| 10 | 3,628,800 | 7 |
20! is the largest factorial that fits in a signed 64-bit integer, and 170! is the largest that fits in a double.
How this is worked out
The formula
n! = 1 × 2 × 3 × … × n, with 0! = 1 by definition. Recursive form: n! = n × (n − 1)! Non-integer n: n! = Γ(n + 1) = ∫₀^∞ t^n e^(−t) dt Trailing zeros (Legendre): ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … Stirling: ln n! ≈ n ln n − n + ½ ln(2πn)
Open How it’s calculated above to see this worked through with your own numbers.
What you enter
- n
- Whole numbers give n!. Non-integers are evaluated as Γ(n + 1), the smooth extension of the factorial.from -170 to 1000000000 · defaults to 10
What you get back
- n!main answer
- Number of digits
- Whole-number inputs only.
- log₁₀(n!)
- Trailing zeros
- How many zeros n! ends in — Legendre's formula.
- As an ordinary number
- Blank above 170!, which overflows double precision.
What this assumes
- Whole-number inputs up to 1000 are exact (arbitrary-precision integers); above that the value is derived from log Γ(n + 1).
- Non-integer inputs are evaluated as Γ(n + 1) with the Lanczos approximation (g = 7, 9 terms, relative error ≈ 1e-15).
- Negative whole numbers are rejected because gamma has poles there.
- The ordinary-number output is blank above 170!, the double-precision overflow point.
About this calculator
The factorial of n is the product of every whole number from 1 up to n. It counts the number of ways to arrange n distinct things in order, which is why it shows up everywhere in combinatorics, probability and series expansions.
How to use it
Enter n. Whole numbers from 0 to 1000 are computed exactly with arbitrary-precision integers — no rounding at all — and displayed in full up to 40 digits, in scientific notation above that with the exact digit count. Beyond 1000 the calculator switches to logarithms, which still give a correct exponent, correct leading digits and an exact digit count, but not every digit.
Why 0! = 1
Not a convention pulled out of the air. There is exactly one way to arrange zero objects (do nothing), so the count is 1. The recursion n! = n × (n − 1)! forces the same answer: 1! = 1 × 0!, so 0! must be 1. And it is what makes the binomial coefficient formula work at the edges, since C(n, 0) = n! ÷ (0! n!) needs 0! = 1 to give 1.
Non-integers and the gamma function
Factorials of fractions are not nonsense — they are values of the gamma function, the unique log-convex smooth curve through all the factorial points (that uniqueness is the Bohr-Mollerup theorem). Here n! is computed as Γ(n + 1) using the Lanczos approximation with nine coefficients, accurate to about one part in 10¹⁵. Two landmarks worth knowing: Γ(½) = √π, so (−½)! ≈ 1.7724539, and (½)! = √π ÷ 2 ≈ 0.8862269.
Gamma has poles at zero and every negative integer, so (−1)!, (−2)! and so on are genuinely infinite rather than merely large. The calculator refuses those instead of returning a huge number.
Reading the other outputs
- Digits is how many decimal digits n! has. It grows fast: 100! has 158 digits, 1000! has 2,568.
- Trailing zeros counts the zeros n! ends in, which is exactly the number of times 5 divides it (there are always more 2s than 5s). 100! ends in 24 zeros.
- log₁₀(n!) is the practical number for large factorials — comparisons and ratios that would overflow in ordinary arithmetic are easy in logs.
- As an ordinary number is blank above 170!, because 171! exceeds the largest double-precision value, roughly 1.8 × 10³⁰⁸.
How fast it grows
Faster than any exponential. 52! — the number of ways to shuffle a deck of cards — is about 8 × 10⁶⁷, comfortably more than the number of atoms in the Milky Way. Every well-shuffled deck in history has almost certainly been in an order no deck has ever been in before.
Frequently asked questions
▸What is 10 factorial?
3,628,800. That is 1 × 2 × 3 × … × 10, and it is the number of ways to put ten distinct items in order.
▸Why is 0 factorial equal to 1?
There is exactly one arrangement of nothing, and the recursion 1! = 1 × 0! forces 0! = 1. It also keeps the binomial coefficient formula correct at its edges.
▸Can you take the factorial of a decimal?
Yes, through the gamma function: n! = Γ(n + 1). It is the unique smooth, log-convex curve through the integer factorials, and it is what this calculator uses for non-integer inputs.
▸Why is the factorial of a negative number undefined?
The gamma function has poles at 0, −1, −2 and every negative integer, so those factorials are infinite. Negative non-integers such as −0.5 are perfectly well defined.
▸How many trailing zeros does 100! have?
- Count the factors of 5: ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24. There are always more factors of 2 available to pair with them.
Put this calculator on your own site
A working factorial, free for any site, with no ads and no sign-up. It resizes to fit wherever you paste it and updates itself as this page improves.
Paste this anywhere. It works on any site, carries no ads, never expires, and always shows the current version.
Factorial Calculator by CalculateItNow
The page's own title. The clearest description of what the link leads to.
The credit line sits outside the widget on purpose, so it is a real link on your page rather than one buried in a frame. Please keep it — it is what pays for CalculateItNow staying free and ad-free. The script only resizes the widget to fit its contents; drop it and the widget still works.
Browse every calculator widget·How to add it to WordPress, Squarespace or Wix
Related calculators
The questions people ask next to a factorial.
nCr and nPr, with or without repetition — exact answers for huge counts, the formula substituted, and a plain explanation of when order matters.
Test any number up to a trillion for primality, get its full factorisation, the nearest primes either side, and how many primes lie below it.
Arithmetic and geometric sequences: the nth term, the sum of the first n terms, the first ten terms listed, and the infinite sum when the series converges.
Raise any base to any power — negative, fractional or huge — with the expanded multiplication, scientific notation and the rule that applies shown.
Convert any number to scientific, engineering and E notation with chosen significant figures, or expand a × 10ⁿ back to a plain decimal — exactly, no float noise.
Add, subtract, multiply, divide, take remainders and raise to powers with integers of hundreds of digits — exactly, well past what a normal calculator holds.