Last updated ·Published ·By the WiserWork team

Factorial Calculator

Calculate n! (factorial) with expansion, scientific notation & stats

Max: 170 (beyond this exceeds JavaScript number limits)

10! =
3,628,800
3,628,800
7
Digits
2
Trailing Zeros
27
Sum of Digits
10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1

Factorial multiplies every whole number from n down to 1, and it grows so violently that this page stops at 170 because 171 factorial overflows a JavaScript number to infinity.

What is the Factorial Calculator?

Writing n! means multiply n by every whole number beneath it, so 5! is 120 and 10! is already 3,628,800. It is defined as 1 when n is zero, which is the empty product and also the single way of arranging nothing at all. Factorials count the orderings of n distinct items, which is why they sit inside the permutation and combination formulas and in the denominators of Taylor series. This page returns the value, plus digit count, trailing zeros, digit sum and the full product written out.

Key Features

  • Stat cards for digit count, trailing zeros and digit sum
  • Expansion box writes out the whole product down to 1
  • Quick buttons for 0, 5, 10, 20, 50 and 100
  • Values above 20 factorial also appear in scientific notation
  • Input clamps itself to the 0 through 170 range

Common Use Cases

  • Checking a permutations answer when arranging n distinct items in order
  • Finding how many trailing zeros 100 factorial ends with for a puzzle
  • Demonstrating combinatorial explosion to a class in a single keystroke
  • Sanity-checking code that computes factorials near the double-precision ceiling

How to Use the Factorial Calculator

  1. Type a whole number from 0 to 170 into the Enter a Number field.
  2. Or press a quick button for 0, 5, 10, 20, 50 or 100.
  3. Read the upper line for scientific notation and the line beneath for the grouped value.
  4. Compare Digits, Trailing Zeros and Sum of Digits in the three stat cards.
  5. Scroll the Expansion box to see every factor written out in order.

Tips for Best Results

  • Exact digits stop at 22 factorial; beyond that only the leading fifteen or so are reliable.
  • Trailing Zeros stays exact at any n because it counts factors of five rather than reading digits.
  • Sum of Digits past 22 factorial adds up a rounded value, so treat it as indicative only.
  • For exact enormous factorials use a BigInt or arbitrary-precision library instead of this page.

Why Use WiserWork's Factorial Calculator?

Factorials are the standard illustration of combinatorial explosion, and watching 100 factorial run to 158 digits makes the point faster than any explanation. The multiplication here uses ordinary double-precision numbers in a loop, so it is exact through 22 factorial and approximate after that, with BigInt used only to measure the finished value into a digit string. Treat it as a reference and teaching aid rather than an exact big-integer engine.

Who Uses the Factorial Calculator?

Students working through permutations and combinations homework, teachers who want a live demonstration of how quickly n! outruns exponential growth, and programmers checking exactly where their language's default number type gives up. Puzzle solvers use the trailing-zero count, which is a classic competition question.

Frequently Asked Questions

Why does the input stop at 170?

171 factorial is roughly 1.24 times 10 to the 309th, which exceeds the largest value a double-precision number can hold, about 1.8 times 10 to the 308th. Anything above 170 would simply display as infinity.

Does the calculator use BigInt?

Not for the arithmetic. The product is built in a plain loop using ordinary numbers, and BigInt appears only at the end to turn the finished value into a digit string for the digit count and digit sum.

Up to which n are the digits exactly right?

Through 22 factorial. From 23 factorial upward the value no longer fits a double exactly, so only the leading fifteen to seventeen significant digits should be trusted and the trailing digits are an artifact of rounding.

Why is 0 factorial equal to 1?

It is the empty product, and combinatorially there is exactly one way to arrange no objects. The quick button is labeled 0! = 1 for that reason, and the expansion box reads 1 by definition.

Where do factorials actually turn up?

Permutations of n distinct items number n!, arrangements of r items from n are n!/(n-r)!, and combinations are n!/(r!(n-r)!). They also form the denominators in Taylor and Maclaurin series, and e equals the sum of 1/n!.

How many trailing zeros does 100 factorial have?

Twenty-four. Each trailing zero needs a factor of ten, and fives are scarcer than twos, so you add 100 divided by 5, then by 25, then by 125, giving 20 plus 4 plus 0.

Can it calculate permutations or combinations directly?

No. It takes a single value of n and returns n! only. Work out nPr or nCr by computing each factorial separately and dividing.

What happens if I enter a decimal or a negative number?

A decimal is truncated to its whole part, and anything below zero is clamped up to 0. The field also rewrites itself to the clamped value as you type.

How many digits does 100 factorial have?

158, and by the time you reach the 170 ceiling the answer is 307 digits long. The Digits stat card shows this count for whatever n you enter.

Is anything sent to a server?

No. The loop, the statistics and the expansion are all computed in the page, and no number you enter is transmitted or logged.

Factorial is the fastest-growing function most people meet before they meet anything faster, and the digit counts here show why exact arithmetic gives up so early. Use it to check homework, then reach for arbitrary precision when 22 factorial stops being enough.

Found this useful? Share it