Factorial Calculator
Calculate the factorial (n!) of a number
About This Tool
Factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 to n. By definition 0! = 1. Factorials grow extremely fast: 10! is about 3.6 million; 20! exceeds 2.4 quintillion; 70! overflows standard 64-bit floating point.
Enter an integer to receive its exact factorial. Inputs above roughly 170 typically return scientific notation or BigInt-style strings, since the value exceeds the range of standard number representations.
The definition is recursive: n! = n × (n-1)!, with base case 0! = 1. The 0! = 1 convention isn't arbitrary — it makes formulas like the binomial coefficient C(n,k) = n! / (k! × (n-k)!) work without special cases for k = 0 or k = n. There's also an empty-product justification: the product of zero numbers is the multiplicative identity, which is 1. Factorial extends to non-integers via the gamma function: Γ(n+1) = n! for non-negative integers, with gamma defined for all complex numbers except non-positive integers. So (1/2)! = Γ(3/2) = √π/2. Most calculators don't expose this; specialized scientific computing libraries (SciPy, Mathematica) do.
A worked example. 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040. 10! = 3,628,800. 13! exceeds 6 billion, the limit where typical 32-bit signed integers overflow. 21! exceeds 2^63, the limit for signed 64-bit integers. 170! is roughly 7.26 × 10^306, near the upper bound of IEEE 754 double-precision floating point. 171! overflows. For larger inputs, the calculator returns either scientific notation or arbitrary-precision integer strings using BigInt-style arithmetic. Stirling's approximation, n! ≈ √(2πn) × (n/e)^n, gives values accurate to better than 1 percent for n above 10 and is useful when only the magnitude matters — common in statistical mechanics and information theory.
Limitations and where factorial appears in practice. The function applies to non-negative integers in its standard form. Negative integers and most non-integers are undefined as factorials proper, requiring the gamma extension. Probability and combinatorics use factorials heavily: permutations of n objects (n!), combinations of k from n (n choose k = n!/(k!(n-k)!)), Taylor series (1/n! coefficients), and Poisson and exponential distributions. The numbers grow fast enough that direct computation hits overflow quickly; combinatorial calculations often cancel large factorials before evaluating to keep numbers manageable. For example, computing C(1000, 5) directly multiplies 1000 down to 996 and divides by 5! — never actually computing 1000! itself, which would overflow any non-arbitrary-precision system.
The about text and FAQ on this page were drafted with AI assistance and reviewed by a member of the Coherence Daddy team before publishing. See our Content Policy for editorial standards.