Skip to main content
math

Factorial Calculator

Calculate the factorial of a number (n!) — the product of all positive integers from 1 to n. Essential for permutations, combinations, probability, and combinatorics.

Reviewed by Chase FloiedUpdated

This free online factorial calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Enter your values below and see results update in real time as you type. Perfect for everyday calculations, homework, or professional use.

Must be a non-negative integer (0, 1, 2, 3, ...)

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the Factorial Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.

2

Review your inputs

Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.

3

Read the results

The Factorial Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.

4

Explore parameter sensitivity

Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.

Formula Reference

Factorial Calculator Formula

See calculator inputs for the governing equation

Variables: All variables and their units are labeled in the calculator interface above. Input fields accept values in multiple unit systems — select your preferred unit from the dropdown next to each field.

When to Use This Calculator

  • Use the Factorial Calculator when you need a quick mathematical result without writing out all the steps manually, saving time on repetitive calculations.
  • Use it to verify hand calculations on tests or assignments and catch arithmetic mistakes.
  • Use it when teaching or explaining mathematical concepts to others, demonstrating how changing inputs affects the result.
  • Use it to explore the behavior of mathematical functions across a range of inputs.

About This Calculator

The Factorial Calculator is a free mathematical calculation tool for students, educators, and professionals who need quick, reliable results. Calculate the factorial of a number (n!) — the product of all positive integers from 1 to n. Essential for permutations, combinations, probability, and combinatorics. The underlying algorithms implement well-established mathematical formulas and numerical methods. Results are computed instantly in the browser. This tool is useful for learning, verification of hand calculations, and rapid exploration of mathematical relationships. All computation happens locally — no data is sent to a server.

About Factorial Calculator

The factorial function, denoted n!, is one of the most important functions in discrete mathematics and combinatorics. It is defined as the product of all positive integers from 1 to n, with the special case that 0! = 1. Factorials grow extraordinarily fast — 10! = 3,628,800, 20! exceeds 10^18, and 100! has 158 digits. The factorial function is central to permutations (the number of ways to arrange n objects is n!), combinations (n choose k = n! / (k!(n−k)!)), and probability distributions such as the Poisson and binomial distributions. The factorial also appears in Taylor series expansions: e^x = sum of x^n/n!, sin(x) = sum of (−1)^n x^(2n+1)/(2n+1)!, and many others. The gamma function extends the factorial to non-integer and complex arguments via Γ(n+1) = n!, connecting it to integral calculus and complex analysis.

The Math Behind It

The factorial function satisfies the recurrence relation n! = n × (n−1)! with base case 0! = 1. This recursive definition makes it natural for both mathematical proofs by induction and recursive programming. The choice of 0! = 1 is not arbitrary — it ensures that the formula for combinations works correctly (for instance, n choose 0 = n!/0!n! = 1) and that the empty product convention is maintained. Stirling's approximation, n! ≈ √(2πn)(n/e)^n, provides an excellent estimate for large factorials and is widely used in statistical mechanics and information theory. A more precise version includes correction terms. The prime factorization of n! can be determined by Legendre's formula: the exponent of prime p in n! is the sum of floor(n/p^k) for k = 1, 2, 3, ... . Wilson's theorem states that (p−1)! ≡ −1 (mod p) if and only if p is prime, connecting factorials to primality testing. The number of trailing zeros in n! equals the sum of floor(n/5^k), since each trailing zero comes from a factor of 10 = 2 × 5, and factors of 5 are less frequent than factors of 2.

Formula Reference

Factorial

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

Variables: n = non-negative integer; 0! = 1 by convention

Stirling's Approximation

n! ≈ √(2πn) × (n/e)^n

Variables: Useful for approximating large factorials

Worked Examples

Example 1: Basic Factorial

Calculate 6!

Step 1:6! = 6 × 5 × 4 × 3 × 2 × 1
Step 2:= 6 × 5 = 30
Step 3:30 × 4 = 120
Step 4:120 × 3 = 360
Step 5:360 × 2 = 720
Step 6:720 × 1 = 720

6! = 720

Example 2: Trailing Zeros in 25!

How many trailing zeros does 25! have?

Step 1:Count factors of 5: floor(25/5) = 5
Step 2:Count factors of 25: floor(25/25) = 1
Step 3:Total = 5 + 1 = 6

25! has 6 trailing zeros

Common Mistakes & Tips

  • !Forgetting that 0! = 1 (not 0). This is defined by convention and consistency.
  • !Trying to compute factorial of negative numbers — factorial is only defined for non-negative integers (use the gamma function for extensions).
  • !Underestimating how fast factorials grow — even 20! exceeds the capacity of 64-bit integers.
  • !Confusing n! with n^n — they are very different (5! = 120, but 5^5 = 3125).

Related Concepts

Used in These Calculators

Calculators that build on or apply the concepts from this page:

Frequently Asked Questions

Why is 0! equal to 1?

By convention and mathematical consistency. It ensures that the combinations formula works (n choose 0 = 1), the recursion n! = n × (n−1)! holds at n = 1, and the empty product (product of no factors) equals 1.

What is the largest factorial my computer can handle?

Standard 64-bit integers overflow at 21!. Floating-point numbers can approximate up to about 170!. For exact results with larger factorials, arbitrary-precision libraries are needed.