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 Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
Advertise on this page
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