Skip to content

Factorial Calculator

Calculate the factorial of any number online with support for large values. Free factorial calculator for math and combinatorics work.

Calculators
Instant results
10! =
3628800
7 digits

How to Use Factorial Calculator

1

Enter a number

Type any positive integer or zero. The tool calculates n! immediately.

2

View result

The output shows the full factorial value, scientific notation for large values, and optionally the intermediate steps (such as 5×4×3×2×1=120).

3

Compare with related

The tool may also show the 0! through n! sequence, a growth comparison, and related calculations like combinations and permutations.

4

Use in math problems

Apply the results to probability calculations, combinatorics, programming verification, and mathematical homework.

When to Use Factorial Calculator

Mathematical computations and combinatorics

Combinatorics, probability, and permutations all rely heavily on factorials. The tool computes n! quickly for any non-negative integer n, which fits homework problems, prepared classroom examples, calculations of combinations and permutations in research, partition function work in physics, and statistical analysis of sample arrangements.

Programming and algorithm verification

Comparing your code's output against known factorial values is a fast way to verify an implementation. The tool helps with testing recursive against iterative implementations, debugging factorial-based algorithms, exploring algorithmic complexity through factorial growth, validating combinatorial code in production, comparing BigInt and standard integer overflow behavior, and providing reference values for computer science coursework. Edge cases like 0!, 1!, and very large factorials are worth testing explicitly.

Probability and statistics calculations

The permutations formula P(n,r) = n!/(n-r)! and the combinations formula C(n,r) = n!/(r!(n-r)!) both depend on factorials. The tool produces accurate n! values that feed into these formulas, which is useful in statistics coursework, gambling odds, decision theory, lottery probability, card game mathematics, dice combination analysis, and anything that involves counting arrangements or selections from sets.

Educational learning and mathematical exploration

Factorials grow at a startling rate. 5! is just 120, but 10! is already 3.6 million, 15! climbs over a trillion, and 20! exceeds 2.4 quintillion. The tool reveals this growth interactively, which helps students learn combinatorics, visualize rapid-growth functions, understand why factorial complexity is impractical for large n in algorithms, and grasp how quickly counting problems run past computational feasibility.

Factorial Calculator Examples

Simple factorial

Input
5!
Output
5! = 5 × 4 × 3 × 2 × 1 = 120

A basic factorial: 5 × 4 × 3 × 2 × 1 = 120. This pattern shows up in probability problems, permutation counting, and basic combinatorics.

Larger factorial

Input
20!
Output
20! = 2,432,902,008,176,640,000 (~2.43 × 10^18)

20 factorial reaches 2.4 quintillion, which approaches the limits of 64-bit integer arithmetic. Anything larger requires BigInt support, which the tool typically provides.

Stirling approximation

Input
100! approximated
Output
Exact: huge number (158 digits). Stirling: ~9.33 × 10^157.

Stirling's approximation says n! ≈ √(2πn)(n/e)^n, and it shines for very large factorials where exact computation is impractical. It comes up regularly in physics, statistics, and complexity analysis.

Tips & Best Practices for Factorial Calculator

  • 1.Factorial grows extremely fast. 10! is 3.6 million, 20! is 2.4 quintillion, and 100! has 158 digits. Watch for overflow in your implementation.
  • 2.Use BigInt when the inputs get large. Standard 32-bit and 64-bit integers overflow around 12! and 20! respectively, while JavaScript's BigInt handles arbitrary size.
  • 3.0! equals 1 by definition. This is easy to forget, and it shows up naturally in combinations where C(n,0) = 1.
  • 4.Negative factorials are undefined. Real-valued factorials extend through the Gamma function, where Γ(n+1) = n!, but that goes beyond the scope of a basic factorial calculator.
  • 5.When you actually need probability calculations, look for combinations or permutations tools directly — they tend to be more useful than raw factorial.
  • 6.Stirling's approximation, n! ≈ √(2πn)(n/e)^n, is accurate for large n and useful whenever an exact value is impractical to compute.

Frequently Asked Questions

A factorial is the product of all positive integers up to a given number, written n!. So n! = n × (n-1) × ... × 1. Examples: 5! is 5×4×3×2×1 = 120, 0! is defined as 1, and 1! is 1. Factorials show up in probability, combinatorics, calculus, and computer science.