331+ free tools. No sign-up. No hidden fees. Explore the toolkit

Factorial Calculator

n! (n factorial) means multiply every whole number from 1 up to n: 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials grow astonishingly fast — 20! is already over 2 quintillion — so this calculator uses exact integer arithmetic and shows every digit, not a rounded approximation.

Enter a whole number from 0 to 170 and get the exact factorial, the number of digits and the trailing zeros.

A whole number from 0 to 170. 0! = 1 by definition. Above 170! the exact value runs past 300 digits, and 171! overflows ordinary floating-point numbers.

Result

Save to Pinterest
Note: Most calculators compute factorials with floating-point numbers, which stop being exact above 21! — a double holds about 16 significant digits, and 21! needs 20. This page multiplies with BigInt exact integers, so 20! = 2,432,902,008,176,640,000 is exact to the last digit. The cap is 170 because 171! exceeds the largest number a standard double can hold (about 1.8 × 10³⁰⁸).

How It Works

The factorial of a whole number n is the product of every whole number from 1 to n: n! = 1 × 2 × 3 × … × n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition 0! = 1 — the empty product — which also keeps the rule n! = n × (n − 1)! working all the way down: 1! = 1 × 0! forces 0! to be 1.

Factorials grow faster than almost anything you meet in everyday maths. 10! is 3,628,800, 20! is over 2 quintillion, and 100! has 158 digits. That growth is why exactness matters: ordinary floating-point arithmetic rounds after about 16 digits, so a standard calculator's answer for 25! is already wrong in its last digits. This page multiplies exact integers (BigInt), so every digit shown is correct.

Trailing zeros are counted by factors of 5. Each trailing zero needs one factor of 2 and one factor of 5; 2s are plentiful, so the count is the number of 5s in 1 × 2 × … × n: floor(n/5) + floor(n/25) + floor(n/125) + … For 100! that is 20 + 4 = 24 trailing zeros.

Worked Examples

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

20! = 2,432,902,008,176,640,000 — 19 digits, with 4 trailing zeros.

100! has 158 digits and 24 trailing zeros.

170! ≈ 7.257416 × 10³⁰⁶ — 307 digits, the largest factorial this calculator shows.

Assumptions

Last reviewed: 15 November 2026.

Built and tested by SumKitTool — see how we check our numbers.

How to Use This Calculator

Enter a whole number from 0 to 170. The exact factorial, digit count and trailing zeros update live as you type.

  1. Enter n — any whole number from 0 to 170.
  2. Read the exact value in the headline (for very large factorials the headline shows scientific notation and the exact value is in the table).
  3. Check the digit count and trailing zeros in the table below.

The Reset button restores the worked example (20! = 2,432,902,008,176,640,000).

Tips and Practical Advice

Frequently Asked Questions

What is a factorial?

The factorial of a whole number n, written n!, is the product of every whole number from 1 to n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials count arrangements: n! is the number of ways to order n different objects.

Why is 0! equal to 1?

By definition, and because it keeps the maths consistent: n! = n × (n − 1)!, so 1! = 1 × 0! forces 0! to be 1. It also matches combinatorics — there is exactly one way to arrange zero objects: the empty arrangement.

Why does this calculator stop at 170!?

Two reasons. First, 171! is larger than the biggest number standard floating-point arithmetic can hold (about 1.8 × 10³⁰⁸), so ordinary calculators overflow. Second, exact values beyond 170! run past 300 digits. 170! itself is about 7.257416 × 10³⁰⁶.

How many trailing zeros does 100! have?

24. Trailing zeros come from factors of 10, and each 10 needs a 2 and a 5 — 5s are scarcer, so you count them: 100 ÷ 5 = 20, plus 100 ÷ 25 = 4, giving 24. This calculator counts them the same way for any n up to 170.

Last updated: