1. Home
  2. Calculators
  3. Factorial Calculator

Factorial Calculator

For students and programmers who need an exact factorial rather than a rounded one.

Free, no sign-up. Runs in your browser: nothing is uploaded.

Free workspace included. Docs, spreadsheets, notes and tasks that save on your device. No sign-up.Take a look

How to use Factorial Calculator

  1. Enter your numbers, or press a sample to see an example.
  2. Read the results and the table under them.
  3. Copy the results or download the table.

Features

  • Exact value with all digits
  • Digit count and trailing zeros
  • Scientific notation
  • Double factorial n!!
  • Ways to arrange n different things

Supported formats

Input

  • A typed number

You get

  • On-screen results
  • Copyable text
  • CSV table

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Factorial Calculator is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • It computes n! exactly for n up to 3,000; the digits of very large results are long.
  • Only whole numbers 0 and above have a factorial here (no gamma function).
  • Everything runs in your browser; nothing you type is sent anywhere.

Guide

Computing n factorial exactly, with digit counts, trailing zeros and the double factorial

A factorial multiplies a whole number by every smaller positive whole number, so 5 factorial is 5 × 4 × 3 × 2 × 1, which is 120. It counts the ways to put n different things in a row, and it grows faster than almost anything else you meet in school maths. This page gives exact values, so you can see every digit instead of the rounded figure a pocket calculator shows.

How it works

The tool multiplies the numbers from 1 up to n using big integers, a number type with no fixed size. Ordinary floating-point numbers hold about fifteen significant digits, so a program that computes 25 factorial with them already gets the last digits wrong. Exact integers do not lose anything, and the page can go up to 3,000 factorial, a number with more than 9,000 digits. Short results, such as 30 factorial with its 33 digits, are written out in full. Longer ones are shown in scientific notation together with the digit count, and a text box named All digits of n! holds every digit, with a button to copy it and one to download it as a file such as factorial-100.txt.

What the results show

You get the value, the number of digits, the count of zeros at the end and the value in scientific notation. The line about ways to arrange n different things repeats the value in words that match the question most people have in mind. The double factorial, written n with two exclamation marks, multiplies every second number down from n, so 20 double factorial is 20 × 18 × 16 and so on down to 2, which is 3,715,891,200, and 7 double factorial is 7 × 5 × 3 × 1, or 105.

Trailing zeros

Each trailing zero in a factorial comes from a factor of 10, which is a pair of 2 and 5. There are always more 2s than 5s, so the number of zeros equals the number of 5s in the product. That is n divided by 5, plus n divided by 25, plus n divided by 125, and so on, each rounded down. For 100 that gives 20 + 4 = 24 zeros, and for 20 it gives 4 + 0 = 4. The tool uses this rule rather than counting digits of the huge number.

Edge cases

The input must be a whole number from 0 to 3,000, and anything else is rejected with a message. Negative numbers and fractions do not have a factorial here, since that would need the gamma function, which this page does not implement. 0 factorial and 1 factorial are both 1, and the double factorial of 0 is also 1.

A worked example

20 factorial is 2,432,902,008,176,640,000, which is 2.4329020081 × 10^18, with 19 digits and 4 zeros at the end. 52 factorial, the number of orderings of a deck of cards, is 8.065817517 × 10^67 with 68 digits and 12 trailing zeros. 100 factorial is 9.3326215443 × 10^157, a number with 158 digits and 24 trailing zeros, and its double factorial has 80 digits. 0 factorial is 1.

Limits

The page handles whole numbers up to 3,000 only, and it does not approximate larger values with Stirling’s formula. It does not compute permutations or combinations directly, so use the dedicated page when you need n choose k.

Checked against the current version of the Factorial Calculator on .

Frequently asked questions

Why is 0 factorial equal to 1?

Because it is the empty product, and because the formula for choosing k items from n, n factorial over k factorial times (n minus k) factorial, needs it to give 1 way to choose nothing or everything.

How many ways can a deck of cards be ordered?

52 factorial, which is about 8.07 times 10 to the 67th power, a number with 68 digits. It is so large that any well-shuffled deck is almost certainly in an order that has never occurred before.

What is 20 factorial?

20! is exactly 2,432,902,008,176,640,000, which has 19 digits.

How many trailing zeros does a factorial have?

Count the factors of 5 in 1 × 2 × … × n, which is n/5 plus n/25 plus n/125 and so on, rounded down. For 100! that is 24.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.