Home › Math & Science › Factorial Calculator

Factorial Calculator

Use this free factorial calculator to find n! for any whole number from 0 to 100. Type a number and the calculator works out the exact integer using BigInt arithmetic, so there is no rounding and no loss of precision, even for the enormous values factorials quickly become. For small numbers you get the full answer plus a step-by-step expansion; for large numbers you also get the answer in scientific notation, so you can see at a glance just how huge it is.

5! = 120
120 is the exact value · 3 digits

Enter a whole number from 0 to 100. Factorials grow extremely fast — 20! is already over 2.4 quintillion.

How fast factorials grow

Each bar shows how many digits n! has. The count climbs from 3 digits at 5! to 158 digits at 100!.

How it works

A factorial is one of the simplest ideas in mathematics, and one of the fastest-growing. The factorial of a whole number n, written n!, is the product of every whole number from 1 up to n. So 5! means 5 × 4 × 3 × 2 × 1, which equals 120. The number 4! is 4 × 3 × 2 × 1 = 24, 3! is 3 × 2 × 1 = 6, 2! is 2 × 1 = 2, and 1! is simply 1. The one case that surprises people is 0!: by definition it equals 1. That is not a guess or a fudge — it makes the rules of arithmetic work smoothly. There is exactly one way to arrange zero objects, which is to do nothing, and the rule n! = n × (n − 1)! only holds for n = 1 if 0! is 1, since 1! = 1 × 0! must equal 1.

Factorials answer a very practical question: in how many ways can you arrange a set of different things in a row? If you have five different books and a shelf with five spaces, the first space can hold any of the five books, the second any of the remaining four, the third any of the remaining three, then two, then one — 5 × 4 × 3 × 2 × 1 = 120 different arrangements. The same counting shows up in card games, where a standard 52-card deck has 52! possible orders, in sports fixtures, in passwords, and in probability, where factorials are the building blocks of permutation and combination formulas. Whenever you see "how many ways can these be ordered", a factorial is usually hiding in the answer.

The reason this calculator uses BigInt arithmetic is that ordinary computer numbers cannot hold factorials exactly once they get large. A normal floating-point number stores about 15 to 17 significant digits, so it would round 20! to something like 2.43290200817664 × 10^18 and silently lose the exact ending. BigInt is a way of doing arithmetic with whole numbers of any size, digit by digit, so the calculator gives you the true integer — 2432902008176640000 for 20! — with every digit correct. That precision matters when you are checking homework or verifying a combination formula by hand.

Even with exact arithmetic, a 158-digit number is not something anyone wants to read in full, which is why the calculator changes how it shows the answer as n grows. For n up to 20 it prints the complete integer, because 20! at 19 digits is still readable. For n above 20 it shows the value in scientific notation as well — a leading digit, a decimal point, a few more digits, and a power of ten — so the scale of the answer is obvious. The result panel also tells you how many digits the exact value has, and the bar chart beside the calculator shows that digit count climbing from 3 at 5! to 65 at 50! and 158 at 100!. That growth is faster than exponential in a practical sense: each step multiplies by a bigger number than the last, so the digit count accelerates.

One more property is worth knowing. Because every factorial from 2! upward includes the factors 2 and 5, every factorial of 5 or more ends in at least one zero, and the number of trailing zeros grows as n grows: 5! ends in one zero, 10! ends in two, 20! ends in four, and 100! ends in 24 zeros. The step-by-step expansion shown for small values makes this visible — you can watch the factors 2 and 5 pair up to make the trailing zeros. The calculator shows the full expansion for n up to 10, where the whole product still fits on the page comfortably.

Worked example

Take 5!, the classic first factorial. The expansion is 5 × 4 × 3 × 2 × 1. Multiply from the left: 5 × 4 = 20, then 20 × 3 = 60, then 60 × 2 = 120, and finally 120 × 1 = 120. So 5! = 120, an exact three-digit answer, and the calculator shows exactly that, with the full expansion written out underneath.

Now try a larger one, 20!. Multiplying all the numbers from 1 to 20 gives 2432902008176640000 — nineteen digits, ending in four zeros, which matches the trailing-zero rule above. Type 20 into the calculator and it prints this exact value in full, because 20 is the largest n whose factorial is still shown completely. It also reports the scientific form, 2.43290200817664 × 10^18, and notes that the answer has 19 digits.

For the extreme end, type 100. The exact value is a 158-digit integer beginning 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000. The calculator shows the scientific form 9.332621544394415 × 10^157, which is how mathematicians and scientists normally write a number of this size, and the chart shows the bar for 100! towering over the bars for 5!, 10!, 20! and 50!.

FAQ

What is a factorial?

A factorial, written n!, is the product of all the whole numbers from 1 up to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials count the number of ways to arrange n different objects in a row, which is why they appear in probability, permutations and combinations.

What is 0 factorial?

0! equals 1 by definition. It may look odd, but it keeps the mathematics consistent: there is exactly one way to arrange zero objects (do nothing), and the rule n! = n × (n − 1)! still works for n = 1, since 1! = 1 × 0! = 1 × 1 = 1.

Why does the calculator show scientific notation for large factorials?

Factorials grow so fast that the full number soon becomes too long to read: 100! has 158 digits. Showing the exact integer is still possible for smaller values, but for n above 20 the calculator shows the value in scientific notation, such as 9.33 × 10^157 for 100!, so the size of the answer stays clear at a glance.

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

No — factorials are only defined for whole numbers from 0 upwards. Negative numbers and decimals have no factorial in ordinary arithmetic (mathematicians extend the idea with the gamma function, but that is a different calculation). This calculator accepts whole numbers from 0 to 100 only.

Where are factorials used in real life?

Factorials count arrangements, so they show up wherever order matters: shuffling a deck of cards (52! possible orders), arranging books on a shelf, scheduling a round of fixtures, or working out lottery and password combinations. They are also the building blocks of permutation and combination formulas used in statistics.