Skip to content
Kordu Tools
Math & Numbers Runs in browser Updated 30 Mar 2026

Factorial Calculator

Calculate n factorial, double factorial, subfactorial, trailing zeros, and digit count. BigInt support for exact large number results.

Enter a non-negative integer (0 to 10,000).

Enter a number to calculate.

Double Factorial (0!!)

0

Subfactorial (!0)

0

Trailing Zeros

0

Digit Count

0

nn!Digits

Formulae

n! = 1 × 2 × 3 × ... × n (0! = 1)

n!! = product of every second integer down from n

!n = (n−1)(·!(n−1) + !(n−2)), !0 = 1, !1 = 0

Trailing zeros = Σ floor(n / 5^k) for k = 1, 2, 3, ...

Loading rating…

How to use Factorial Calculator

  1. Enter a number

    Type a non-negative integer into the input field. Decimals are not valid inputs for factorial.

  2. View factorial results

    See n!, double factorial (n!!), subfactorial (!n), trailing zero count, and digit count instantly.

  3. Switch to table mode

    Toggle table mode to generate factorials for a range of values side by side.

  4. Copy the result

    Click the copy button to copy the full factorial value to your clipboard.

  5. Explore large values

    Try values like 20, 50, or 100 to see exact results using BigInt arithmetic.

Factorial Calculator FAQ

What is a factorial?

n! is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition, 0! = 1.

How do I calculate a factorial?

Multiply n × (n−1) × (n−2) × ... × 1. For large values, enter the number here for an instant exact result.

What is a double factorial (n!!)?

n!! multiplies every other integer from n down to 1 or 2. For example, 7!! = 7 × 5 × 3 × 1 = 105.

What is a subfactorial?

!n counts derangements — permutations where no element appears in its original position. For example, !3 = 2 (the three-element derangements are 231 and 312).

How are trailing zeros counted?

Trailing zeros in n! come from factors of 10 = 2 × 5. Since 5s are rarer, count: floor(n/5) + floor(n/25) + floor(n/125) + ...

What is the largest factorial I can compute?

This tool uses BigInt so it handles arbitrarily large values. Display may truncate extremely long numbers for readability.

Why is 0! = 1?

By convention and combinatoric logic: there is exactly one way to arrange zero objects (do nothing), so 0! = 1.

Can I use this for homework?

Yes. The formula is shown with results so you can verify your manual calculation.

What is factorial used for?

Factorials appear in permutations (n!), combinations (nCr = n!/r!(n-r)!), probability, and Taylor series expansions.

Is any data sent to a server?

No. All calculations run entirely in your browser. Nothing is uploaded or stored.

Background

Compute factorials and related functions for any non-negative integer. Enter n to calculate n! (standard factorial), n!! (double factorial, which multiplies every other integer), !n (subfactorial, counting derangements where no element stays in its original position), the number of trailing zeros in n!, and the total digit count of the result. BigInt arithmetic provides exact results even for very large inputs — no floating-point rounding. A table mode generates factorials for a range of values at once, which is useful for quickly comparing growth rates. Trailing zeros in n! are counted using Legendre's formula: sum of floor(n/5^k). Ideal for combinatorics homework, probability problems, and exploring the rapid growth of the factorial function. All processing runs entirely in your browser.