Count zeros without calculating the factorial
Enter n to count how many zeros occur at the end of n! in decimal notation. For example, 100! ends in 24 zeros. This tool also shows each nonzero contribution from a power of five.
Why powers of five matter
Every trailing zero requires a factor of 10, made from 2 × 5. Factorials contain at least as many factors of two as factors of five, so count the fives: floor(n/5) + floor(n/25) + floor(n/125) and so on. Multiples of 25 contribute a second five; multiples of 125 contribute a third.
Limits and special cases
Enter a whole number from 0 through 10^100, without separators or scientific notation. Since 0! = 1, its trailing-zero count is zero. The count uses exact BigInt arithmetic. This tool counts ending zeros in base ten, not all zero digits inside a factorial. Processing stays in your browser.