onlinecalculator.me
Download App

7 common questions about factorials answered

Factorials are a simple math concept with massive outputs. Learn how they work, why zero factorial equals one, and why they routinely break standard calculators.

Aug 28, 2026 5 min read

A student sitting at a wooden desk pressing buttons on a scientific calculator next to an open textbook.

An exclamation point in a math equation does not mean the formula is excited. It indicates a factorial. The concept is simple enough—multiplying a sequence of descending numbers—but it scales up so fast that it routinely breaks standard calculators. Here is a look at how factorials work, why they grow so violently, and the rules governing them.

What is a factorial?

A factorial is the product of an integer and all the positive integers below it. Mathematicians use an exclamation point to denote it. Take 5! (read out loud as “five factorial”). You calculate it by multiplying 5 by 4, 3, 2, and 1.

5! = 5 × 4 × 3 × 2 × 1 = 120

The general rule looks like this: n! = n × (n−1) × (n−2) × … × 2 × 1. You will see this operation constantly in combinatorics, which is the branch of math dedicated to counting, arranging, and grouping sets of items. Any time you are trying to figure out how many different ways a set of objects can be ordered, you are likely going to use a factorial.

Why does 0! equal 1?

This trips up almost everyone. If a factorial means multiplying a number by every smaller integer down to 1, how can zero factorial equal 1?

The short answer is mathematical convention. Mathematicians agreed to define 0! as 1 because leaving it as zero breaks other vital formulas.

First, look at how factorials step backward. The rule is n! = n × (n−1)!. If we apply this to the number 1, the formula says 1! = 1 × 0!. Since 1! is obviously 1, 0! has to equal 1 for the math to hold up.

Second, factorials are the foundation of combinations. Say you have five distinct items and you want to choose all five. Common sense says there is exactly one way to do that. But the mathematical formula for combinations involves dividing by factorials. In this exact scenario, the formula puts (5−5)! in the denominator, which equals 0!. If 0! was zero, you would be dividing by zero, triggering a mathematical error. Setting 0! to 1 keeps everything functioning.

How fast do factorials grow?

Factorial growth outpaces exponential growth, turning seemingly small inputs into massive outputs in just a few steps.

For example, 5! is a modest 120. Just five steps later at 10!, you are already in the millions. Here is a quick look at how rapidly these numbers scale:

nn!
01
5120
103,628,800
202.433 × 10^18

By the time you reach 52!—which represents the number of different ways you can shuffle a standard 52-card deck—the result is a 68-digit number. That value is vastly greater than the estimated number of atoms in the Earth.

Why do calculators switch to scientific notation or break at 171!?

Try calculating 171! on a standard digital tool. You will likely hit an error or a flat “Infinity” message. This is a hardware and software limitation, not a math rule.

Most modern computers and web browsers, including those running JavaScript, rely on a standard called double-precision floating-point (specifically, IEEE 754) to store numbers. This format allocates a specific amount of memory for each number, creating a hard ceiling of roughly 1.8 × 10^308.

The exact value of 170! is a towering 307-digit number, which just barely scrapes under that ceiling. But 171! equals about 1.24 × 10^309. That pushes past the maximum representable range and causes a memory overflow. To handle inputs of 171 and up without crashing, a well-built calculator abandons direct multiplication. Instead, it relies on logarithms to calculate and display the scientific notation.

How do you know how many digits a large factorial has?

Writing out the full integer for something like 100! is usually impractical. But figuring out exactly how many digits it contains is surprisingly easy. You do not even need to calculate the factorial itself to find out.

The trick relies on logarithms. A base-10 logarithm essentially tells you what power you need to raise 10 to in order to get your number. Because our number system is base-10, this directly correlates to digit length. The number of digits in any positive integer equals the floor (which means rounding down to the nearest whole number) of its base-10 logarithm, plus 1.

Digit count = floor(log10(n!)) + 1

Using this method, we know 100! has exactly 158 digits. Instead of multiplying a hundred numbers, a computer program just adds up the base-10 logarithms of every integer from 1 to 100, rounds down, and adds 1.

Can you find the factorial of a decimal or a negative number?

Strictly speaking, the standard factorial operation only applies to non-negative whole numbers. You cannot drop −3 or 2.5 into the n! formula and get a valid result.

However, mathematicians hate leaving gaps in patterns. They created the Gamma function, which extends the logic of factorials to real and complex numbers, including decimals. The Gamma function plots a smooth curve that connects the whole numbers on a graph. It is a vital tool in advanced calculus and physics, but if you are just working through standard probability problems, you will only ever deal with whole, positive integers and zero.

Where are factorials used in real life?

You probably will not need to calculate 50! to balance your checkbook. But factorials are the invisible engine powering statistics, probability, and computer science.

They show up any time you need to calculate permutations (where you arrange items in a specific order) or combinations (where you pick a group of items and the order does not matter). If you pull up a combinations calculator to check your odds of drawing a specific poker hand or hitting the lottery, factorials are doing the heavy math in the background.

They also help routing software map out every possible delivery path to find the shortest one. As the number of delivery stops increases, the number of possible routes grows factorially, which is why optimizing logistics requires heavy computing power. They play a similarly heavy role in training machine learning algorithms and running physics simulations.

To calculate exact values for smaller inputs or find the precise scientific notation for massive ones, use our Factorial Calculator.

Why does zero factorial equal one?
Mathematicians define zero factorial as one by convention to keep vital formulas working. If it equaled zero, it would break combinations formulas by causing division by zero. It also fits the backward-stepping pattern of factorial math.
Why do calculators break at 171 factorial?
Most computers use a standard memory format that has a hard ceiling for the maximum number it can store. The result of 171 factorial pushes past this limit and causes a memory overflow. To handle it, calculators must switch to logarithms and scientific notation.
Can you calculate the factorial of a negative number?
The standard factorial operation only applies to non-negative whole numbers. You cannot use negative numbers or decimals in the basic formula. However, advanced mathematicians use the Gamma function to extend factorial logic to real and complex numbers.
Factorial Calculator Open the calculator →

← More Math articles All articles