Factorial Calculator

n! — the product of all whole numbers from 1 to n, exactly.

Quick answer

  • Formula: n! = 1 × 2 × 3 × … × n, with 0! = 1 by definition
  • Worked example — n! (exact value): 120 (full example below).

Factorial Calculator

Worked example result
n! (exact value)120
Number of digits3

5! = 1 × 2 × 3 × 4 × 5 = 120 — which is why 5 different books can be arranged on a shelf in exactly 120 different orders.

The factorial of n, written n!, is the product 1 × 2 × 3 × … × n. Factorials count arrangements: 5! = 120 is the number of ways to order 5 distinct items in a line.

Factorials grow astonishingly fast — 20! already exceeds 2 quintillion, and this calculator is capped at 170!, a 307-digit number. Results are calculated exactly with big-integer arithmetic and shown in full, not rounded.

The formula

n! = 1 × 2 × 3 × … × n, with 0! = 1 by definition

Worked example

5! = 1 × 2 × 3 × 4 × 5 = 120 — which is why 5 different books can be arranged on a shelf in exactly 120 different orders.

The example is pre-loaded in the result panel — press Calculate with your own numbers to replace it.

Frequently asked questions

Why is 0! equal to 1?

By definition, and it makes the counting formulas work: there is exactly one way to arrange zero items (do nothing). It also follows the pattern n! ÷ n = (n−1)! — 1! ÷ 1 = 1, so 0! = 1.

Where are factorials used?

In permutations and combinations (lottery odds, card shuffles), probability, and the Taylor series in calculus. A shuffled deck has 52! ≈ 8 × 10^67 possible orders — more than atoms in the galaxy.

Why stop at 170?

170! ≈ 7.26 × 10^306 is close to the largest number standard floating-point arithmetic can hold (about 1.8 × 10^308); 171! overflows it. The exact digits are still shown in full here.

Category: Math calculators

Sources & methodology

This calculator applies the formula shown on this page exactly as written, using the standard definitions for its inputs. Results are computed from the values you enter — no data is stored — and are rounded only for display.

Content last reviewed by CalcHub Editorial.

Embed this calculator on your site

Free to use with attribution — paste the snippet below and the calculator appears on your page, with a link back to CalcHub.

<iframe src="https://calculator-site-57a.pages.dev/embed/factorial-calculator" width="100%" height="640" style="border:1px solid #d9e2ea;border-radius:12px" loading="lazy" title="Factorial Calculator — CalcHub"></iframe>

Open the embed version →