ZapKit

Factorial calculator

Work out n! exactly, even when the answer has thousands of digits, along with how many digits and trailing zeros it has.

What is a factorial?

The factorial of a whole number n, written n!, is the product of every whole number from 1 to n. It counts the ways to arrange n different things in order: 3 books can be lined up 3! = 6 ways. Factorials appear throughout probability, statistics and combinatorics.

Enter n to get its factorial in scientific notation, the exact value, the number of digits, the number of trailing zeros and the base-10 logarithm. For small n the multiplication is written out, and a table lists the first factorials up to 12! for reference.

How to use the Factorial calculator

  1. 1.Enter n

    A whole number from 0 to 5,000.

  2. 2.Read the result

    Scientific notation, digits, trailing zeros and log₁₀.

  3. 3.Copy the exact value

    Shown in full, or first and last digits for huge results.

Example: shuffling a deck of cards

The number of orders a 52-card deck can be in is 52!:

52!
8.065817 × 10^67
Digits
68
Trailing zeros
12

n! = n × (n − 1) × … × 2 × 1

A well-shuffled deck is almost certainly in an order never seen before in history.

Big numbers, exactly

Factorials grow faster than powers: 20! already passes two quintillion and 70! has more digits than a normal calculator can hold. Results here use whole-number arithmetic with no limit on size, so every digit is exact, not rounded.

Trailing zeros come from pairs of 2 and 5 in the product, and since 5s are scarcer, their count is ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ and so on. 0! is 1 by definition, which keeps formulas such as combinations working.

Frequently asked questions

Why is 0! equal to 1?

There is exactly one way to arrange nothing, and it keeps formulas like n! = n × (n−1)! consistent.

Can I take the factorial of a decimal?

Not here. The scientific calculator's ! key uses the gamma function for decimals.

Where are factorials used?

In counting arrangements, probability, combinations and series such as eˣ.

Why stop at 5,000?

5000! already has 16,326 digits; larger values gain little but take longer.

More Utilities tools