FLXCode Factorial Calculator

FLXCode apps

Appearance

Factorial Calculator

Type a whole number. Up to 1000 you get every digit of n!. Above that you get scientific notation and the exact digit count.

Example

2432902008176640000

20! has 19 digits.

  • 20! = 20 × 19 × 18 × … × 2 × 1 = 2432902008176640000
  • 19 digits.
  • 4 trailing zeros: each zero comes from a pair 5 × 2, and the number of 5s is ⌊20/5⌋ = 4.
  • Scientific notation: 2.43290200817 × 10¹⁸ (first 12 digits).

No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.

Problem or idea? Email us

Worked examples

nn!Note
01Defined as 1
51205 × 4 × 3 × 2 × 1
103628800About 3.6 million
202432902008176640000The biggest factorial that fits in a signed 64-bit integer
528.06581751709 × 10⁶⁷Ways to order a deck of cards
1009.33262154439 × 10¹⁵⁷158 digits
10004.02387260077 × 10²⁵⁶⁷The largest exact one here
1000002.82422941 × 10⁴⁵⁶⁵⁷³Past 1000: Stirling's approximation

How fast it grows

10! is 7 digits, 20! is 19, 100! is 158, 1000! is 2,568. The digit count of n! grows a little faster than n itself, because each new factor adds about log₁₀(n) digits. Compare this with a power: 2¹⁰⁰⁰ has 302 digits, while 1000! has 2,568. A factorial beats any exponential in the end.

What factorials count

  • Orderings: 52! ways to shuffle a deck, around 8 × 10⁶⁷.
  • Combinations: C(n, k) = n! ÷ (k! × (n−k)!). Choosing 5 cards from 52 gives 2,598,960.
  • Probability, series expansions (e = 1/0! + 1/1! + 1/2! + ...) and the Taylor formulas.

Trailing zeros

The page shows how many zeros 100! ends with, and why. Take n = 100: 100 ÷ 5 = 20, 100 ÷ 25 = 4, 100 ÷ 125 = 0, so 24 zeros. Multiples of 25 give two 5s, so they get counted twice, and multiples of 125 three times. For the prime pieces of any n!, see the prime factorization calculator on a smaller value.

Numbers this uses

  • Exact range: 0 to 1000, computed by BigInt multiplication. Results over 24 digits show in scientific notation in the headline, and all digits are in a box you can copy.
  • Approximate range: 1001 to 1,000,000, using ln(n!) = n ln n − n + ½ ln(2πn) + 1/(12n) − 1/(360n³) + 1/(1260n⁵). The result has about 9 good digits.
  • Not supported: decimals, negatives, and n above 1,000,000.

Prime factors of a smaller number are on the factor calculator.

Nothing you type is uploaded. We count events without cookies (details).

FAQ

What is a factorial?

n! is the product of every whole number from 1 up to n. 5! = 5 × 4 × 3 × 2 × 1 = 120. It counts the ways to put n different things in a row.

Why is 0! equal to 1?

There is exactly one way to arrange nothing, the empty arrangement. It also keeps the pattern n! = n × (n−1)! working: 1! = 1 × 0! only holds if 0! is 1. And the formulas for combinations need it.

How large can the factorial be?

Exact up to 1000!, which has 2,568 digits. Beyond that the tool uses Stirling's approximation up to 1,000,000, giving about 9 digits and the exact digit count.

What is Stirling's approximation?

n! ≈ √(2πn) × (n/e)ⁿ. The tool uses the log form with the correction terms 1/(12n) − 1/(360n³), which is accurate to better than 1e-10 in the logarithm for n above 1000. The count of digits is exact.

How many trailing zeros does n! have?

Each zero comes from a factor of 10 = 2 × 5, and there are far more 2s than 5s. So count the 5s: n/5 + n/25 + n/125 + ... with the fractions rounded down. 100! has 20 + 4 = 24 trailing zeros.

Can I take the factorial of a decimal or negative number?

Not with this page. Whole numbers only. Decimals use the gamma function, where (n−1)! = Γ(n), and negative integers have no value at all.

Why do calculators show an error for 171!?

A 64-bit float tops out near 1.8 × 10³⁰⁸, and 171! is about 1.2 × 10³⁰⁹. This page uses whole-number arithmetic with no limit, so 171! through 1000! come out exact.

Is the number I type saved or sent?

No. The factorial is worked out in your browser. What you type is not put in the address bar, not stored and not counted. We only count whether the result was exact or approximate.

More from FLXCode

Share Factorial Calculator