Factorial Calculator

Calculate exact factorials of large numbers, with digits and trailing zeros.

Factorial Calculator tool

—
n! (exact)
—
Number of digits
—
Trailing zeros
—
Scientific notation

About the Factorial Calculator

Factorials count arrangements: 10! = 3,628,800 is the number of ways to line up ten people, and 52!, the number of ways to shuffle a deck of cards, has 68 digits. Ordinary calculators give up early or round, but this factorial calculator uses exact big-integer arithmetic for n up to 5,000 and reports the number of digits and trailing zeros too.

The number of trailing zeros comes from Legendre's formula: each zero needs a factor of 10 = 2 × 5, and factors of 5 are the scarcer ones, so the count is ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … . For 25!, that is 5 + 1 = 6 zeros. The digit count is checked directly from the exact result, and the scientific notation shows the leading digits and the power of ten.

Example: 10! = 3,628,800; 20! = 2,432,902,008,176,640,000 (19 digits); 25! = 15,511,210,043,330,985,984,000,000 with 6 trailing zeros; and 100! has 158 digits and 24 trailing zeros. By convention 0! = 1, which keeps formulas such as the number of combinations consistent.

Factorials count arrangements: there are 52! ≈ 8.07 × 10⁶⁷ ways to shuffle a deck of cards. For choosing and arranging items use the permutation and combination calculator, for probabilities the probability calculator, and for big powers the exponent calculator.

How to use the Factorial Calculator

  1. Enter nType a whole number from 0 to 5,000.
  2. Read the exact valueSee n! in full, with digits grouped for reading.
  3. Check the summarySee the number of digits, trailing zeros and scientific notation.
  4. Copy the resultUse Copy results to paste the full number elsewhere.

Factorial Calculator features

  • Exact factorials up to 5,000!
  • Digit count and trailing zeros
  • Scientific notation with leading digits
  • Legendre's formula working for zeros
  • 0! = 1 handled by convention
  • Fast BigInt calculation in your browser
  • Copy the full result

Common uses

  • Counting arrangements and orderings
  • Checking combinatorics homework
  • Exploring how fast factorials grow
  • Trailing-zero puzzles in math competitions
  • Programming test data for big-number code

Factorials in practice: arrangements, shuffled cards and why numbers explode

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

A factorial multiplies every whole number from 1 up to a given number: 5! is 5 × 4 × 3 × 2 × 1 = 120. Factorials count the ways to arrange things, which is why they appear in probability, scheduling and puzzles. They also grow faster than almost any everyday function, which leads to some striking facts. This guide covers arrangements, circular seating, card shuffles, route planning, Stirling's approximation and calculator limits.

Counting arrangements

If you have n different items, there are n! ways to arrange them in a row: n choices for the first position, n − 1 for the second, and so on. Ten books on a shelf can be arranged in 10! = 3,628,800 different orders. Even a small number of items produces a large number of arrangements, which is why trying every possibility quickly becomes impractical.

Seating around a table

Arrangements in a circle work differently, because rotating everyone one seat to the left gives the same seating. For n people around a round table, there are (n − 1)! distinct arrangements. Six guests can be seated in 5! = 120 different ways. If the table has a head seat, so positions are distinguishable, the count goes back up to 6! = 720.

A worked example: a dinner party

A host has 6 guests and wants to try different seating plans. Around a round table, there are 120 arrangements. If two guests who are married must sit together, treat them as one unit: that leaves 5 units around the table, giving 4! = 24 arrangements, and the couple can sit in 2 orders, so 48 plans in total.

Breaking the problem into steps like this is the standard way to count arrangements with conditions, and factorials appear at each step.

Shuffled cards

A standard deck of 52 cards can be arranged in 52! ways, about 8.07 × 10⁶⁷. That number is so large that a properly shuffled deck is almost certainly in an order that has never existed before in the history of card games. Even if every person on Earth shuffled a deck every second since the universe began, they would not come close to repeating the orders.

Route planning

The travelling salesman problem asks for the shortest route visiting every city on a list exactly once and returning home. With 10 cities, the number of distinct round trips is 9! ÷ 2 = 181,440. With 20 cities it exceeds 6 × 10¹⁶. Because the number of routes grows factorially, delivery companies use clever methods that find very good routes without checking every possibility.

Stirling's approximation

For large n, factorials can be estimated with Stirling's formula: n! is approximately the square root of 2πn multiplied by (n/e)ⁿ. For 10!, the formula gives about 3,598,696, within 1% of the true value of 3,628,800, and the relative error shrinks as n grows. The formula is used in statistics and physics, where exact factorials of huge numbers are unnecessary.

Calculator limits

Many handheld calculators can display numbers only up to about 10¹⁰⁰. Since 69! is about 1.7 × 10⁹⁸ and 70! is about 1.2 × 10¹⁰⁰, 69 is the largest factorial many calculators can show, a well-known limit. Tools that use big-integer arithmetic, like this calculator, can compute exact factorials of much larger numbers.

Factorials in probability

Many probability formulas use factorials, including combinations, which count selections where order does not matter. The number of ways to choose 6 numbers from 49 in a lottery is 49! ÷ (6! × 43!), which is 13,983,816. Factorials cancel heavily in such formulas, so it is easier to compute them by multiplying only the necessary terms.

Common mistakes

  • Using n! for circular arrangements instead of (n − 1)!.
  • Confusing arrangements, where order matters, with selections, where it does not.
  • Computing huge factorials when they will cancel in a formula.
  • Expecting ordinary calculators to handle factorials above 69.

Related tools

For selections and arrangements of part of a group, use Permutation and Combination Calculator. For probability, try Probability Calculator, and for very large results, Scientific Notation Converter.

Anagrams and repeated letters

Factorials count anagrams too. The letters of a word with all different letters can be arranged in n! ways, but repeated letters reduce the count, because swapping identical letters makes no new arrangement. The word LETTER has 6 letters with two Es and two Ts, so it has 6! ÷ (2! × 2!) = 720 ÷ 4 = 180 distinct arrangements. The same division handles any repeated items, such as arranging identical coloured beads on a string.

Factorials and the number e

Factorials appear in one of the most important formulas in mathematics: the number e, about 2.71828, equals 1 + 1 + 1/2! + 1/3! + 1/4! and so on forever. Because factorials grow so quickly, the terms shrink fast, and adding just the first ten terms gives e correct to six decimal places. Similar series using factorials let computers calculate sines, cosines and exponentials.

Limits

Results are exact using big-integer arithmetic up to the calculator's limit; very large values are also shown in scientific notation.

Frequently asked questions

What is a factorial?

n! is the product of all positive whole numbers up to n. For example 6! = 6 × 5 × 4 × 3 × 2 × 1 = 720. It counts the number of ways to arrange n different items in order.

Why is 0! equal to 1?

There is exactly one way to arrange zero items: do nothing. Defining 0! = 1 also keeps formulas consistent, such as n! = n × (n − 1)! and the combination formula.

How many trailing zeros does 100! have?

24. Using Legendre's formula: ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24. Each zero comes from a pair of factors 2 and 5. There are far more factors of 2 than of 5, so the 5s set the count.

How many digits does 100! have?

158 digits. It begins 93,326,215,443,944,152,681 and ends with 24 zeros. In scientific notation it is about 9.3326 × 10¹⁵⁷, far more than the number of atoms in the observable universe.

Can you take the factorial of a negative number or a fraction?

Not with the ordinary definition. The gamma function extends factorials to fractions and most negative values, with Γ(n + 1) = n!, but negative whole numbers remain undefined.

How fast do factorials grow?

Faster than any exponential. Stirling's approximation, n! ≈ √(2πn) (n/e)ⁿ, shows the growth: 10! is in the millions, 20! in the quintillions and 70! already exceeds a googol (10¹⁰⁰).

What is 52 factorial?

52! ≈ 8.0658 × 10⁶⁷, the number of ways to order a standard deck of cards. It is so large that any well-shuffled deck is almost certainly in an order never seen before.

What is the factorial formula?

n! = n × (n − 1) × (n − 2) × … × 2 × 1, which can also be written recursively as n! = n × (n − 1)! with 0! = 1. So once you know 9! = 362,880, then 10! = 10 × 362,880 = 3,628,800.

Where are factorials used?

In counting problems: arranging books on a shelf, ordering race finishers, shuffling cards and seating guests all use factorials. They also appear in permutations, combinations, probability, the binomial theorem and the Taylor series used to compute functions such as eˣ.