Factorial Trailing Zeros Calculator

This factorial trailing zeros calculator counts how many zeros sit at the end of a factorial without ever computing the (astronomically large) factorial itself. Enter n and the calculator returns the number of trailing zeros of n factorial, along with the number of factors of 5 and of 2 it contains. A trailing zero comes from a factor of 10, which is a 5 times a 2. Since factors of 2 are far more common than factors of 5 in a factorial, the number of trailing zeros equals the number of factors of 5, found by adding up n divided by 5, by 25, by 125 and so on. The formula, a worked example and the assumptions are set out below.

Conservation Amendment Bill
 
Factors of 5 
Factors of 2 

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

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-06-21 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.