Skip to content
Calculated in the browser

Factorial

Multiplies the integers from 1 to n. Zero factorial is 1.

How it is calculated

The exact integer is shown up to and including 18. After that, an ordinary browser number no longer keeps every digit.

n! = 1 × 2 × … × n

Where the numbers come from

  • Number

Example

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

Questions

Why does 0! equal 1?

That is the convention, so combination formulas do not break on an empty product.

A fractional factorial?

Integers only. The gamma function for fractions is not calculated.

Why is the ceiling 18?

19! no longer fits in JavaScript's exact integers.