CalcWorldHub
Free online calculator · no signup

Factorial trailing zeros calculator

Count terminal zeroes in n factorial without calculating the huge integer. Enter your numbers below to see the result and method.

A better way to figure it out
Clear
inputs.
∑
Clear result · useful details
Free calculatorNo signup ✓

Related calculators and articles

Compare methods and explore more free tools in math.

Browse the full math category →

Factorial trailing zeros calculator — Non-negative integer n and calculation method
Factorial trailing zeros calculator: inputs and calculation method.

How to use this calculator

Free Factorial trailing zeros calculator. Count terminal zeroes in n factorial without calculating the huge integer. Review the formula and assumptions.

  1. Enter Non-negative integer n. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Factorial divisibility

Count factors of ten in n factorial

A trailing zero in base ten contributes one factor of 10 = 2 × 5. In n!, factors of 2 are more plentiful, so the number of trailing zeros is set by the number of factors of 5.

Input and domain

Formula and method

Zeros(n!) = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ⋯

Each multiple of 5 contributes at least one factor of 5; multiples of 25 contribute one additional factor, multiples of 125 another, and so on. Stop when the power exceeds n.

Worked example

For n = 100, the contributions are ⌊100/5⌋ = 20 and ⌊100/25⌋ = 4. Higher powers contribute zero, so 100! ends in 20 + 4 = 24 zeros.

Interpretation and limits

The result is an exact count of base-ten trailing zeros, not the value of n!. At n = 0 the empty product is 1, so the count is zero. The input must be a non-negative integer.

Frequently asked questions

Why do powers of five determine the count?

Each trailing zero needs a factor pair 2 × 5. A factorial contains more factors of 2 than 5, so the number of factors of 5 is limiting.

Why add the terms for 25 and 125?

A multiple of 25 contains two factors of 5, and a multiple of 125 contains three. The extra floor terms count those additional factors.

Is n = 0 allowed?

Yes. Zero factorial is 1 and has no trailing zeros, so the calculator returns 0.

How do I use the Factorial trailing zeros calculator?

Enter Non-negative integer n. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Factorial trailing zeros?

For n = 100, the contributions are ⌊100/5⌋ = 20 and ⌊100/25⌋ = 4. Higher powers contribute zero, so 100! ends in 20 + 4 = 24 zeros.