Factorial calculator

Enter an integer and calculate its factorial (n!), the product of all integers from 1 to n.

What it is

The factorial of a number, written with an exclamation mark, is the product of every integer from 1 up to that number: 5! = 5×4×3×2×1 = 120. It answers a very concrete question: in how many different ways can n things be lined up? Five books on a shelf can be arranged in 120 ways, ten in over three and a half million.

Zero factorial is one

It looks like a mistake and it's a definition, with a reason behind it: 0! = 1 because there is exactly one way to line up zero things, namely to line up none. Keeping this convention makes every formula in combinatorics work without special cases, which is why everyone uses it.

It grows faster than anything

The factorial grows faster than any power. 10! is three and a half million, 20! is more than two billion billion, 52! — the number of ways to shuffle a deck of cards — is a number with sixty-eight digits. It's the sum people quote to say something true and unintuitive: when you shuffle a deck properly, that precise order has almost certainly never come up before in history.

On a computer's ordinary numbers the factorial stops being exact very soon, and above 170 it becomes infinity outright. Here arbitrary-precision integers are used, so the numbers are exact to the last digit even when they have hundreds of them.

Nearby tools

For the other sequence that grows like an avalanche there is Fibonacci sequence. For powers Power calculator, for complete expressions Scientific calculator, and if what you need is to draw at random rather than count the combinations Random number generator.