# Factorial Calculator

URL: https://hifreetools.com/calculators/factorial-calculator

> Compute the factorial n! of any non-negative integer exactly — from small values like 5! = 120 up to massive results like 100!, with full digits, scientific form, and a digit count.

## Quick answer

The factorial of a non-negative integer n, written n!, is the product of every integer from 1 up to n, so n! = 1·2·3·…·n. For example, 5! = 1·2·3·4·5 = 120, and by definition 0! = 1. This calculator multiplies the terms using arbitrary-precision integers, so even 100! returns its exact 158-digit value rather than a rounded approximation.

## Formula

- n! = 1 × 2 × 3 × … × n
- n! = n × (n − 1)!
- 0! = 1 (empty product)

## Inputs

- n (non-negative integer) (0 to 100000); default 5

## Worked examples (computed by the page's own function)

- n (non-negative integer) = 5 → n! (exact) = 120, Scientific form = 120, Number of digits = 3  (5! = 1 × 2 × 3 × 4 × 5 = 120)
- n (non-negative integer) = 10 → n! (exact) = 3628800, Scientific form = 3.62880 × 10^6, Number of digits = 7  (10! = 1 × 2 × 3 × 4 × 5 × 6 × 7 × 8 × 9 × 10 = 3628800)
- n (non-negative integer) = 20 → n! (exact) = 2432902008176640000, Scientific form = 2.43290 × 10^18, Number of digits = 19  (20! = 1 × 2 × 3 × … × 20 = 2432902008176640000)

## Verification

Checked against 12 reference cases (expected values computed independently). Reviewed 2026-10-27. Latest change 2026-10-28: Moved to the schema renderer with a sourced ledger. Still exact (BigInt) with n capped at 100,000; the full value is now shown as plain digits without thousands separators, and large n computes faster (binary splitting).

## FAQ

**What is a factorial in simple terms?**
A factorial n! is what you get when you multiply every whole number from 1 up to n together. For example, 4! = 1·2·3·4 = 24. It counts the number of ways to arrange n distinct items in a row, which is why it shows up constantly in counting and probability.

**Why is 0! equal to 1 and not 0?**
0! is defined as 1 because it represents the empty product — multiplying no numbers together gives the multiplicative identity, 1. It also makes formulas consistent: there is exactly one way to arrange zero items, and the combination formula nCn = n!/(n!·0!) only equals 1 when 0! = 1.

**Can you take the factorial of a negative number or a decimal?**
Not with the ordinary factorial. n! is defined only for non-negative integers (0, 1, 2, …). The gamma function Γ(x) extends the idea to non-integers and gives values like Γ(0.5) = √π, but it is still undefined for negative integers. This calculator handles only non-negative integers.

**How large a factorial can this calculator handle?**
It uses JavaScript BigInt, so results are exact with no rounding even for hundreds of digits. We cap n at 100,000 only to keep your browser responsive; 100! (158 digits) or 1000! return instantly. For comparison, 100! ≈ 9.33 × 10¹⁵⁷.

**What is the difference between a factorial and a permutation?**
A factorial n! counts arrangements of all n items. A permutation nPr = n!/(n−r)! counts ordered arrangements of just r items chosen from n. So a full permutation of all items, nPn, equals n!. Factorials are the building block for both permutations and combinations.

**Why does my phone calculator give a rounded value for 25!?**
Most calculators use floating-point (double-precision) numbers, which are exact only up to about 15–16 significant digits. 25! has 26 digits, so the last digits get rounded to zeros (you often see something like 1.551121e+25). This tool computes with exact integers, returning the full 15,511,210,043,330,985,984,000,000.


## Sources

- [Wikipedia — Factorial](https://en.wikipedia.org/wiki/Factorial)
- [Wolfram MathWorld — Factorial](https://mathworld.wolfram.com/Factorial.html)
- [NIST DLMF §5.2 — Gamma function definitions (n! = Γ(n + 1))](https://dlmf.nist.gov/5.2)
- [OEIS A000142 — Factorial numbers](https://oeis.org/A000142)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Factorial Calculator", https://hifreetools.com/calculators/factorial-calculator
