# Factorial calculator — n!

> The factorial of n (written n!) is the product of all positive integers from 1 to n. This calculator shows the exact value for small inputs and scientific notation for large ones.

Calculate n! for any non-negative integer. Shows the exact value for small n and scientific notation for large factorials with digit count.

**Interactive version:** https://onlinecalculator.me/math/factorial/
**Category:** Math

## Formula

```
n! = n × (n−1) × (n−2) × … × 2 × 1
0! = 1 (by definition)
```

## Common values

| n | n! |
|---|----|
| 0 | 1 |
| 5 | 120 |
| 10 | 3,628,800 |
| 20 | 2.433 × 10^18 |
| 50 | 3.041 × 10^64 |
| 100 | 9.333 × 10^157 |

## Frequently asked questions

### What is a factorial?

n! = n × (n−1) × (n−2) × … × 2 × 1. By definition, 0! = 1. Factorials grow extremely fast: 10! = 3,628,800 and 100! has 158 digits.

### Why does the calculator switch to scientific notation above 170?

JavaScript's floating-point numbers (IEEE 754 doubles) overflow at about 1.8 × 10^308. Since 171! ≈ 1.24 × 10^309, exact computation exceeds the representable range. The calculator uses a logarithm-based approach to show the scientific notation accurately.

### What is 0! and why is it 1?

By convention, 0! = 1. This preserves the identity n! = n × (n−1)! when n = 1 (giving 1 = 1 × 0! = 1 × 1) and makes combinatorial formulas like C(n,0) = 1 work correctly.

### How many digits does 100! have?

100! has 158 digits. The digit count equals floor(log10(n!)) + 1.

### How do I share my calculation?

Click "Share with my numbers" to copy a URL that saves your input.

## Sources

- [Factorial (n! and the 0! = 1 convention)](https://en.wikipedia.org/wiki/Factorial) — Wikipedia

## Related calculators

- [Combinations calculator](https://onlinecalculator.me/math/combinations/) — C(n,k) combinations and P(n,k) permutations.
- [GCD and LCM calculator](https://onlinecalculator.me/math/gcd-lcm/) — Greatest common divisor and least common multiple.
- [Quadratic formula calculator](https://onlinecalculator.me/math/quadratic/) — Roots of ax squared plus bx plus c.
- [Standard deviation calculator](https://onlinecalculator.me/math/standard-deviation/) — Sample and population standard deviation.

---

Part of [onlinecalculator.me](https://onlinecalculator.me/) — free calculators that run entirely in your browser.
Machine-readable index: https://onlinecalculator.me/llms.txt
