Factorial Calculator

Calculate the factorial of a non-negative integer.

The Factorial Calculator computes n! for any non-negative integer, delivering instant results for values used in permutations, combinations, and probability. Whether you need 5! for a simple arrangement problem or 100! for advanced combinatorics, this browser-based tool handles it all with arbitrary precision.

Iterating Functions...
Your data stays in your browser
Was this tool useful?
Tutorial

How to use

1
1

Usage Step

Calculate the factorial of a non-negative integer.

Guide

Complete Guide to Factorials

What Is a Factorial?

A factorial, written as 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! is defined as 1, which simplifies many combinatorial formulas. Factorials grow extremely fast—10! is already 3,628,800, and 20! exceeds 2.4 quintillion. This rapid growth is why factorials are central to understanding computational complexity and the limits of brute-force algorithms. The factorial function is one of the first recursive functions students learn, since n! = n x (n-1)!.

Why Factorials Matter

Factorials are the backbone of combinatorics and probability theory. The number of ways to arrange n distinct objects is n! (permutations). Combinations, binomial coefficients, and the binomial theorem all depend on factorials. In probability, factorials appear in the formulas for distributions like the Poisson and multinomial. Beyond pure mathematics, factorials are used in Taylor series expansions, Stirling's approximation, and the gamma function, which extends factorials to non-integer values.

Key Properties of Factorials

Important properties include: (1) n! = n x (n-1)! (recursive definition). (2) 0! = 1 (by convention). (3) n! grows faster than any exponential function. (4) Stirling's approximation: n! is approximately sqrt(2*pi*n) * (n/e)^n for large n. (5) The number of trailing zeros in n! equals the sum of floor(n/5^k) for k = 1, 2, 3... These properties make factorials a rich topic connecting algebra, analysis, and number theory.

Best Practices When Computing Factorials

For small values (n < 20), direct computation is straightforward. For large n, use libraries that support arbitrary precision integers, as standard floating-point will overflow. In programming, prefer iterative computation over recursion to avoid stack overflow. When you only need the ratio of factorials (like in combinations), cancel common factors before multiplying to avoid unnecessarily large intermediate values. Use logarithms of factorials (log-gamma function) when working with very large values in statistical computations.

Examples

Worked Examples

Example: Computing 7!

Given: n = 7

1

Step 1: Write out the product: 7! = 7 x 6 x 5 x 4 x 3 x 2 x 1.

2

Step 2: Multiply sequentially: 7 x 6 = 42, 42 x 5 = 210, 210 x 4 = 840.

3

Step 3: Continue: 840 x 3 = 2520, 2520 x 2 = 5040, 5040 x 1 = 5040.

Result: 7! = 5,040

Example: Permutations Using Factorials

Given: How many ways can 4 people sit in a row?

1

Step 1: This is a permutation of 4 distinct objects: P = 4!.

2

Step 2: Calculate: 4! = 4 x 3 x 2 x 1 = 24.

3

Step 3: Interpret: there are 24 different seating arrangements.

Result: 4! = 24 arrangements

Use Cases

Use cases

Example Case

Factorials are the foundation of counting problems in combinatorics. When calculating how many ways to choose or arrange items, factorials appear in the formulas for permutations (n!) and combinations (n! / (k!(n-k)!)). For example, choosing 3 books from a shelf of 10 involves C(10,3) = 10! / (3! * 7!) = 120 possible selections. This makes factorials essential for probability, statistics, and discrete mathematics.

Formula

Mathematical Formulas

Factorial Definition

n!=k=1nk=1×2×3××nn! = \prod_{k=1}^{n} k = 1 \times 2 \times 3 \times \cdots \times n
VariableMeaning
nA non-negative integer
kIndex from 1 to n

Stirling's Approximation

n!2πn(ne)nn! \approx \sqrt{2\pi n} \left(\frac{n}{e}\right)^n
VariableMeaning
nA large positive integer
eEuler's number (approx. 2.71828)

Frequently Asked Questions

?What is a factorial in math?

A factorial of a non-negative integer n, written n!, is the product of all positive integers less than or equal to n. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120. By definition, 0! = 1.

?Why is 0 factorial equal to 1?

0! = 1 by convention because it makes combinatorial formulas work correctly. For example, C(n,0) = n! / (0! * n!) = 1, meaning there is exactly one way to choose nothing from a set. It also follows from the recursive definition: 1! = 1 x 0!, so 0! must equal 1.

?What is the factorial of a negative number?

The factorial function is not defined for negative integers. However, the gamma function extends factorials to all complex numbers except negative integers, where gamma(n+1) = n! for non-negative integers.

?How fast do factorials grow?

Factorials grow super-exponentially. 10! = 3,628,800; 15! = 1,307,674,368,000; 20! = 2,432,902,008,176,640,000. Even 100! has 158 digits. This is faster than any exponential function like 2^n or 10^n.

?What is Stirling's approximation?

Stirling's approximation estimates n! as approximately sqrt(2*pi*n) * (n/e)^n. It becomes very accurate for large n and is useful when computing exact factorials is impractical, such as in statistical mechanics and information theory.

?How are factorials used in permutations and combinations?

Permutations of n objects = n!. Combinations of choosing k from n = n! / (k!(n-k)!). These formulas count the number of ways to arrange or select items and are fundamental in probability and statistics.

?Is my data private when using this calculator?

Yes. All factorial computations run entirely in your browser. No data is sent to any server, and no information is stored or logged.

?Is this factorial calculator free to use?

Yes. This tool is completely free with no limits on the size of numbers you can compute, no sign-up required, and no advertisements.

Help us improve

How do you like this tool?

Every tool on Kitmul is built from real user requests. Your rating and suggestions help us fix bugs, add missing features and build the tools you actually need.

Rate this tool

Tap a star to tell us how useful this tool was for you.

Suggest an improvement or report a bug

Missing a feature? Found a bug? Have an idea? Tell us and we'll look into it.

Related Tools

Recommended Reading

Recommended Books on Mathematics & Number Theory

As an Amazon Associate we earn from qualifying purchases.

Boost Your Capabilities

Professional Products to Boost Your Math Skills

As an Amazon Associate we earn from qualifying purchases.

Newsletter

Get Free Productivity Tips & New Tools First

Join makers and developers who care about privacy. Every issue: new tool drops, productivity hacks, and insider updates — no spam, ever.

Priority access to new tools
Unsubscribe anytime, no questions asked