gg
Home › Blog › Factorial: the multiplication behind every possible order

Factorial: the multiplication behind every possible order

2026-09-12 · 2 min read
matheverydaynumbers

Factorial answers one question: if you have n distinct things, how many different orders can you put them all in? The answer, written n!, is the product of every whole number from n down to 1 — and it grows so fast that it's worth seeing exactly why before trusting a "big number" your gut wasn't built to estimate.

The method

n! = n × (n − 1) × (n − 2) × … × 2 × 1. By convention, 0! = 1 — there is exactly one way to arrange zero things: the empty arrangement, with nothing left to decide.

A real example: books on a shelf

How many ways can 5 different books be arranged on a shelf? Pick the first slot: 5 choices. Whichever book you pick, the second slot has 4 remaining choices, the third has 3, and so on:

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

120 possible shelf orders for just 5 books — already more than most people would guess.

Why it explodes so fast

Each extra item doesn't add to the count, it multiplies it. Keep going and the growth stops looking like ordinary arithmetic:

Doubling n from 10 to 20 doesn't double or even square the result — 20! is roughly 670 billion times larger than 10!. That's the nature of a product where every new term is itself a bigger number than the last.

Where it shows up: choosing and arranging a subset

Factorial is also the engine behind permutations and combinations of a subset. Arranging r items chosen from n (order matters) is nPr = n! ÷ (n − r)!; selecting r items from n where order doesn't matter is nCr = n! ÷ (r! × (n − r)!). Picking 3 books to read, in order, out of a shelf of 8:

8P3 = 8! ÷ 5! = 8 × 7 × 6 = 336 ways if the reading order matters, or 8C3 = 336 ÷ 3! = 336 ÷ 6 = 56 ways if you just care which 3 you picked.

The 170 ceiling

Factorial itself is defined for any whole number, but a computer storing the result as a standard double-precision number runs out of room after 170! — 171! is large enough to overflow that format entirely. That's a limit of the storage, not of the mathematics: the answer to "what is 171!" still exists, it just needs a different kind of number to hold it than the one this tool (and most calculators) use.

Run your own numbers

The free Factorial calculator computes n! for any whole number from 0 through 170, entirely on your device.

Try it free — with the steps shown

The Factorial runs in your browser and shows exactly how it got the answer, so the method sticks.

Open Factorial

More from the blog