Math
Factorial Calculator
Enter your details
Runs in your browser
How to use it
Using the factorial calculator
- 01
Enter a whole number
Between 0 and 170 inclusive.
- 02
Read the factorial
The full product appears grouped with thousands separators.
- 03
Check magnitude rows
Digit count and power-of-ten size help compare enormous results at a glance.
Good to know
How fast factorials explode
A deck of cards can be shuffled 52! ≈ 8×10⁶⁷ ways; more than atoms in the galaxy. Ten items already offer 3.6 million orderings, which is why brute-force search dies quickly and combinatorics needs smarter tools.
Why 0! equals 1
The empty product is conventionally 1: there is exactly one way to arrange zero objects. This convention keeps permutation formulas like nPr = n!/(n−r)! working cleanly at the boundaries instead of special-casing them.
The 170 ceiling
Computers store numbers as floating-point values capped near 1.8×10³⁰⁸. Since 171! overflows that envelope, the calculator refuses rather than returning Infinity; honest failure beats silent nonsense.
How it's calculated
The math behind this calculator
n! = n × (n−1) × … × 2 × 1 with 0! = 1 by definitionDirect iterative multiplication computes the product exactly as doubles allow. JavaScript numbers overflow past 170! (about 7.3×10³⁰⁶), so that ceiling is enforced with a clear message; negative and non-integer inputs are rejected because the factorial is only defined on whole numbers.
Assumptions & limitations
- Only whole numbers 0 through 170 are accepted.
- Results beyond about 21 digits carry double-precision rounding in their trailing digits.
- 0! equals 1 by mathematical convention.
Worked example
5! = 5 × 4 × 3 × 2 × 1 = 120; the number of ways to arrange five distinct items in order.
FAQ
Frequently asked questions
- Why does 171 fail?
- It exceeds the largest value a double-precision float can hold (~1.8×10³⁰⁸); 170! is the last representable factorial.
- Can I compute 4.5 factorial?
- No; plain factorials need whole numbers. The generalized gamma function extends the idea, but it is outside this tool’s scope.
- Is 0! really 1?
- Yes, by definition of the empty product; it keeps counting formulas consistent at zero items.
- Are the huge results exact?
- Up to roughly 20! yes; larger products keep about fifteen significant digits, so trailing digits may round.
Keep exploring