Finance 44 tools → Date 19 tools → Health 27 tools → Everyday 23 tools → Math 19 tools → Construction 16 tools → PDF 23 tools → Education 10 tools → Conversion 7 tools → Text 12 tools → Image 8 tools → About → Contact →

Factorial Calculator

Runs entirely in your browser — your numbers are never sent anywhere.

n factorial
—

Detail

How the factorial is worked out

Factorial: multiply a number by everything below it

The factorial of a whole number n, written n! and read n factorial, is the product of every whole number from 1 up to n: 5! = 1 × 2 × 3 × 4 × 5 = 120. The exclamation mark is doing heavy lifting in that sentence, because factorials grow faster than almost any other everyday function — faster than powers with a fixed base, since the multiplier itself keeps growing. This calculator works factorials out exactly using big-integer arithmetic for any n up to 500, and also reports two facts about the answer that people ask for surprisingly often: how many digits it has, and how many zeros it ends with.

Exactness is the point here. An ordinary calculator holds about 16 significant digits, so from 21! onwards its display is already an approximation wearing an exact costume, and beyond 170! it gives up entirely and reports infinity — not because the number stops existing, but because it outgrows the storage format. The exact value of 100! has 158 digits; 500! has 1,135. Both are perfectly definite whole numbers, and this page prints every digit of them, so patterns in the digits — and the trailing zero count — can be checked rather than guessed.

Where factorials come from: counting arrangements

n! = 1 × 2 × 3 × … × n  ·  and   0! = 1 by definition

Factorials were born from permutations: the number of ways to arrange n different objects in a row. There are n choices for the first position, n − 1 remaining choices for the second, and so on down to a single forced choice at the end — n × (n − 1) × … × 1 orderings in total. Three books on a shelf have 3! = 6 arrangements; ten books have over 3.6 million; fifty-two playing cards have 52! orders, a number with 68 digits, which is why a thoroughly shuffled deck is almost certainly in an order no deck has ever been in before. The definition 0! = 1 fits the same story: there is exactly one way to arrange nothing — the empty arrangement.

Trailing zeros, counted without the big multiplication

A trailing zero is born whenever a factor of 2 meets a factor of 5 to make a 10. In any factorial there are far more factors of 2 than of 5, so the zeros are governed by the fives: count how many multiples of 5 appear (each contributes at least one factor of 5), add the extra fives hiding in multiples of 25, then 125, and so on. That is the floor(n/5) + floor(n/25) + floor(n/125) shortcut this page uses, and it gives, for example, 6 trailing zeros for 25! — five multiples of 5, plus one extra five inside 25 itself. It is a lovely example of understanding a huge number without ever writing it out, though here you can do both and watch them agree.

Factorials beyond counting

Once arrangements are understood, factorials start appearing as ingredients. Choosing a committee ignores order, so the arrangement count is divided by the factorials of the chosen and unchosen groups — the binomial coefficients behind probability and the expansion of powers. The number e itself is the sum of the reciprocals of all the factorials, and the exponential and trigonometric functions in calculus are built from factorial denominators, which is why factorials sit underneath the Scientific Calculator even when they are not visible. A practical warning belongs here too: because factorials explode, any process whose cost grows like n! — checking every possible route, order or schedule — becomes impossible long before n reaches 25, which is precisely why smart algorithms exist.

Worked example

10 factorial is 1 × 2 × … × 10 = 3628800 — 7 digits, ending in 2 zeros (the multiples of 5 up to 10 are 5 and 10). And 25! ends in 6 zeros: five multiples of 5, plus an extra factor of 5 inside 25.

How to use this calculator

  1. Enter a whole number n between 0 and 500 (decimals are rounded down, with a note).
  2. Read n factorial in the green panel — very long results are shortened there but printed in full in the breakdown.
  3. Check the digit count and trailing zeros alongside the exact value.
  4. Follow the working panel to see the trailing-zero count built from multiples of 5, 25 and 125.

Stirling's approximation: estimating a giant

Long before exact big-integer arithmetic was cheap, mathematicians needed factorials they could not multiply out, and James Stirling's approximation — involving the square root of 2 pi n, times (n divided by e) to the power n — estimates n! with an error that shrinks, in percentage terms, as n grows. It remains the right tool for astronomically large n and for understanding how fast factorials grow: roughly, the digits in n! grow like n times the logarithm of n. Use the exact value on this page when n is at most 500 and every digit matters; reach for the approximation when the question is about scale rather than digits.

Frequently asked questions

Why is 0 factorial equal to 1?
Two reasons agree: there is exactly one way to arrange zero objects, and the pattern n! divided by n equals (n-1)! only keeps working down to 0 if 0! is 1. It is a definition chosen so the rest of mathematics stays consistent.
How many trailing zeros does 100 factorial have?
Count the factors of 5: floor(100/5) is 20 and floor(100/25) is 4, giving 24 trailing zeros. The multiples of 125 do not reach 100, so nothing more is added.
Why do calculators stop or round at large factorials?
Ordinary number storage holds about 16 reliable digits and a maximum near 10 to the power 308, so results are rounded from 21! and overflow at 171!. This page uses big-integer arithmetic, so values up to 500! are exact.
Keep going

Related math calculators