Factorial Calculator

🌐 Language

Factorial Calculator

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

Whole numbers only, from 0 to 170. For example, 5 gives 5! = 120.

Factorial result

Quick answer: A Factorial Calculator finds n! by multiplying every whole number from 1 up to n. For example, 5! = 1 x 2 x 3 x 4 x 5 = 120, 10! = 3,628,800, and 0! = 1 by definition. Enter any whole number from 0 to 170 above to get the exact value, digit count, and trailing zeros.

Factorial Calculator worked example showing 5 factorial equals 120 and 10 factorial equals 3,628,800

What Is a Factorial Calculator?

A Factorial Calculator works out the factorial of a whole number, written with an exclamation mark. The factorial of n, written n!, is the product of every positive whole number from 1 up to n. So 4! means 1 x 2 x 3 x 4, which equals 24, and 6! means 1 x 2 x 3 x 4 x 5 x 6, which equals 720.

Factorials grow fast. By 10 the answer already has 7 digits, and 20! has 19 digits. That speed is why a calculator helps: working out 15! by hand means 15 multiplications, and one slip ruins the answer. The calculator gives the exact value for every whole number from 0 to 170.

Students meet factorials in algebra and combinatorics, where they count permutations and combinations. Programmers meet them in loops and recursion exercises, and probability questions use them too, because the number of ways to arrange a set of items is a factorial.

How the Factorial Calculator Works

The calculator follows the definition directly. For a whole number n greater than 0, it multiplies 1 x 2 x 3 and keeps going until it reaches n, using exact whole-number arithmetic, so 20! comes out as 2,432,902,008,176,640,000, not a rounded decimal. Large answers also appear in scientific notation, which is easier to read once the result passes 15 digits. A scientific notation calculator can convert any of these large results into standard scientific form.

Zero is a special case. The calculator returns 0! = 1, which is the accepted definition in mathematics. It looks odd at first, but it keeps the formulas for permutations and combinations working when a set is empty. In the same way, 1! = 1, because the product of the numbers from 1 to 1 is just 1.

Trailing zeros are counted with Legendre’s formula, which adds up how many times 5 divides into the numbers from 1 to n. Every trailing zero needs one factor of 2 and one factor of 5, and factors of 2 are always plentiful, so the count of 5s decides it. That is why 10! ends in 2 zeros and 100! ends in 24 zeros. A LCM calculator uses the same kind of factor counting for a different job, finding the smallest number two values both divide into.

How to Use the Factorial Calculator

  1. Enter a whole number from 0 to 170 in the box. The calculator starts with 5 as an example.
  2. Click Calculate to see the exact factorial value.
  3. Read the number of digits and the trailing zeros under the main result.
  4. For n up to 10, read the step-by-step multiplication line, which shows every factor.
  5. For larger n, read the scientific notation row, which gives a short form of the answer.
  6. To try another number, clear the box, type the new whole number, and click Calculate again.

Factorial Calculator Examples

These worked examples show the answers the calculator gives, with the digit count and trailing zeros for each one. Every value below was checked against exact whole-number arithmetic.

Worked factorial calculator examples with verified answers
ExampleExact valueDigitsTrailing zeros
0!110
5!12031
10!3,628,80072
20!2,432,902,008,176,640,000194
100!9.332621544 x 10^15715824

The 100! row shows scientific notation because the full number has 158 digits, far too many to read at a glance. Its exact value starts 93,326,215,443,944,152,681,699,238,856,266,700,490,715,968,264,381,621,468,592,963,895,217,599,993,229,915,608,941,463,976,156,518,286,253,697,920,827,223,758,251,185,210,916,864,000,000,000,000,000,000,000,000. After two factorials cancel in a combination, a ratio calculator can simplify the fraction that is left.

Factorial Values From 0! to 10!

These small values turn up in exam questions and quick probability checks. The pattern is clear: each row is the row above it multiplied by the new number, so 7! is 6! times 7.

Factorial values from 0 to 10
nn!
01
11
22
36
424
5120
6720
75,040
840,320
9362,880
103,628,800

That pattern is the key to mental checks: if you know 5! = 120, then 6! is 120 x 6 = 720. Factorials also appear inside fractions, for example in the combination formula, where a fraction to decimal calculator can turn the final fraction into a decimal.

Where Factorials Are Used

Permutations are the most common use. The number of ways to arrange 5 different books on a shelf is 5! = 120, because there are 5 choices for the first spot, 4 for the second, 3 for the third, 2 for the fourth, and 1 for the last. Combinations use factorials too: choosing 3 items from 10 uses 10! divided by 3! times 7!, which works out to 120 ways. Shuffling a deck of 52 cards gives 52! possible orders, a number with 68 digits.

Factorial Calculator FAQ

What is 5 factorial?

5 factorial, written 5!, equals 120. It is 1 x 2 x 3 x 4 x 5, with 3 digits and 1 trailing zero.

What is 0 factorial?

0 factorial equals 1. Mathematicians define 0! = 1 so the formulas for permutations and combinations still work when a set has no items.

How do you calculate a factorial?

Multiply every whole number from 1 up to n. For 7!, work out 1 x 2 x 3 x 4 x 5 x 6 x 7 = 5,040. Above 10, use the calculator above, because the answers get very large.

What is 10 factorial?

10 factorial equals 3,628,800, with 7 digits and 2 trailing zeros. Build it from 9! = 362,880 by multiplying by 10.

What is 20 factorial?

20 factorial equals 2,432,902,008,176,640,000, with 19 digits and 4 trailing zeros, given exactly with no rounding.

Why does this calculator stop at 170?

170! is the largest factorial an ordinary double-precision number can hold, at about 7.26 x 10^306 with 307 digits. 171! is larger than the biggest double-precision value, so most tools return an overflow error past 170.

Learn More

More math calculators: the Mean Median Mode Calculator, the Slope Calculator, the Pythagorean Theorem Calculator, the Square Root Calculator, the Cube Root Calculator, and the Percentage Calculator.

Languages