Factorial Trailing Zeros Calculator

This factorial trailing zeros calculator works out how many zeros sit at the end of n factorial (n!) without ever calculating the enormous factorial itself, which for anything beyond a modest n would run to hundreds or thousands of digits. You enter a single value, n, anywhere from 0 up to 100,000,000, and the calculator instantly returns the number of trailing zeros in n!, alongside the number of factors of 5 and the number of factors of 2 contained within it. The maths behind this is straightforward once you see it: a trailing zero is created by a factor of 10, and every 10 is made from a 5 and a 2. Because factors of 2 turn up far more often than factors of 5 as you multiply consecutive numbers together, the count of trailing zeros is always set by the number of 5s, found by adding up n divided by 5, by 25, by 125 and so on, dropping the remainder each time. Use this tool to check maths homework, verify a proof, or satisfy curiosity about how quickly factorials pick up zeros as n grows. It handles very large values of n instantly, since it only ever performs simple division rather than multiplying out the full factorial. Results are rounded for display and assume you have entered a valid whole number within the stated range.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner: Premium Homes
24 trailing zeros in 100!
Factors of 524
Factors of 297

The formula

The number of trailing zeros of n! is the sum of the floors of n / 5, n / 25, n / 125 and so on, until the term is zero. This counts the factors of 5, which is the limiting factor for making tens.

Worked example

For 100!: floor(100/5) = 20, floor(100/25) = 4, floor(100/125) = 0, so there are 20 + 4 = 24 trailing zeros. Enter 100 to confirm.

Frequently asked questions

Why count factors of 5, not 10?

A trailing zero needs a factor of 10, which is 5 times 2. Factors of 2 are plentiful, so the number of 5s sets the limit.

How many zeros does 100! end in?

24, from 20 multiples of 5 plus 4 extra from multiples of 25.

Do I need the actual factorial?

No. The count uses only divisions of n, so it works for huge n instantly.

Who this calculator is for

This calculator is for students and anyone needing a quick, reliable result.

What this calculator assumes

  • You enter valid numbers.
  • The standard formula is applied.
  • Results are rounded for display.

Formula and sources

Related calculators