Skip to content

Free browser tools that respect your files: everything runs locally, nothing is uploaded.

Factorial Calculator

Calculate factorials with step-by-step solutions, scientific notation for large values, and applications in permutations and combinations.

Calculate Factorial

Enter a non-negative integer (0-170)

5! = 120

(3 digits)

Step-by-Step Solution

1

Formula: n! = n x (n-1) x (n-2) x ... x 2 x 1

2

Special case: 0! = 1 (by definition)

3

5! = 5 x 4 x 3 x 2 x 1

4

5 x 4 = 20

5

20 x 3 = 60

6

60 x 2 = 120

7

120 x 1 = 120

8

Result: 5! = 120

Double Factorial

5!! = 15

5 x 3 x ... = 15

Subfactorial (Derangements)

!5 = 44

Number of permutations with no fixed points

Stirling's Approximation

118

Error: 1.6507%

?How Do You Calculate a Factorial?

Factorial of n (written n!) is the product of all positive integers from 1 to n: n! = n x (n-1) x (n-2) x ... x 2 x 1. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120. Special case: 0! = 1 by definition. Factorials grow extremely fast and are used in permutations, combinations, probability, and Taylor series.

Try These Factorial Examples

Quick-start with common scenarios

Practice Mode

Test your skills with practice problems

Practice with 5 problems to test your understanding.

Your Results

Results are also pinned to the bottom of your screen.

Result

Factorial

120

n!
Input5
Digits3
Formula:

What is a Factorial?

The factorial of a non-negative integer n, denoted n!, is the product of all positive integers less than or equal to n. Factorials are fundamental in combinatorics for counting permutations and combinations, in probability theory, in calculus for Taylor series expansions, and in many areas of mathematics and science. The factorial function grows faster than exponential functions.

Key Facts About Factorials

  • n! = n x (n-1) x (n-2) x ... x 2 x 1
  • 5! = 5 x 4 x 3 x 2 x 1 = 120
  • 0! = 1 (by definition)
  • Factorials grow very fast: 10! = 3,628,800
  • Used in permutations: P(n,r) = n!/(n-r)!
  • Used in combinations: C(n,r) = n!/(r!(n-r)!)
  • 20! has 19 digits, 100! has 158 digits
  • Stirling approximation: n! is approximately sqrt(2 x pi x n)(n/e)^n

Frequently Asked Questions

What is a factorial?

The factorial of n (written n!) is the product of all positive integers from 1 to n. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120. By convention, 0! = 1. Factorials count the number of ways to arrange n distinct objects.

Why is 0! equal to 1?

There are two reasons: (1) Combinatorially, there is exactly one way to arrange zero objects - do nothing. (2) Mathematically, the recurrence n! = n x (n-1)! requires 0! = 1 for 1! = 1 x 0! to equal 1.

How fast do factorials grow?

Factorials grow faster than any exponential function. 10! = 3,628,800 (7 digits), 20! = 2.4 x 10^18 (19 digits), 100! has 158 digits. By Stirling's approximation, n! is approximately sqrt(2*pi*n) x (n/e)^n.

What is a double factorial?

The double factorial n!! multiplies every other number: n!! = n x (n-2) x (n-4) x ... down to 1 or 2. For example: 7!! = 7 x 5 x 3 x 1 = 105, and 8!! = 8 x 6 x 4 x 2 = 384.

What is the subfactorial?

The subfactorial !n counts derangements - permutations where no element is in its original position. For example, !3 = 2: the arrangements (2,3,1) and (3,1,2) are the only derangements of (1,2,3). Formula: !n = n! x sum of (-1)^k/k! from k=0 to n.

Last updated: 2026-01-15

By Joseph OrdunaHow this works

How this works

Formulas follow standard definitions from the NIST Digital Library of Mathematical Functions and classical textbook derivations. Calculations run entirely in your browser. Where a closed-form solution exists, it is used; where an iterative or numerical method is required, the implementation is named on the page.

Sources

  1. [1]
    NIST Digital Library of Mathematical Functions
    Academicdlmf.nist.govAccessed Apr 21, 2026
Joseph Orduna
Founder & Software Engineer

Full-stack software engineer specializing in embedded systems, web architecture, and AI/ML. Founder of Practical Web Tools. Built the gesture-controlled drone IP acquired by KD Interactive (Aura Drone, sold on Amazon).