Skip to content
ToolZone

Factorial Calculator

Compute the factorial of any non-negative integer, the product of all positive integers up to that number, common in probability.

Runs in your browser. Nothing you enter or upload leaves your device.

10! =
3,628,800
7 digits

Keyboard shortcuts

Run the main action
⌘ / Ctrl + Enter
Copy the result
⌘ / Ctrl + Shift + Enter
Download the result
⌘ / Ctrl + S
Paste a file or image into file tools
⌘ / Ctrl + V
Search all tools
⌘ / Ctrl + K
Show these shortcuts
?

You can also drop files anywhere on the page.

About the Factorial Calculator

This factorial calculator computes n!, the product of every whole number from 1 to n, exactly. Enter any value from 0 to 5000 and see the full result with comma separators, plus how many digits it has. It suits students in algebra, statistics, and discrete math, as well as programmers who need exact reference values.

How it works

n! is defined as n × (n - 1) × ... × 2 × 1, with 0! = 1 by convention. The calculator starts from 1 and multiplies by 2, 3, 4, and so on up to n. Standard JavaScript numbers lose precision beyond about 9 × 10^15 and overflow to Infinity after 170!, so the multiplication is done with BigInt, an integer type with no size limit.

Once the product is ready, commas are inserted every three digits for readability, and the digit count is taken from the plain result. The input is limited to 5000 so the browser stays responsive while displaying the result. Inputs outside 0 to 5000, or blank input, show a prompt instead of a result.

How to use

  1. 1

    Enter a whole number in the n! field, between 0 and 5000.

  2. 2

    Read the full value of n! in the result box.

  3. 3

    Check the digit count below the result.

  4. 4

    Click the copy button to copy the number without separators.

Worked examples

Small factorial

Arranging 5 books on a shelf.

Input
5
Result
120

5 × 4 × 3 × 2 × 1 = 120 possible orders.

Default value

The starting example.

Input
10
Result
3,628,800 (7 digits)

Largest that fits in 64 bits

A programmer checking integer limits.

Input
20
Result
2,432,902,008,176,640,000 (19 digits)

21! no longer fits in a signed 64-bit integer.

Shuffling a deck of cards

How many orders can 52 cards be in?

Input
52
Result
A 68-digit number, about 8.07 × 10^67
Limitations
Only whole numbers from 0 to 5000 are accepted; negatives and decimals (such as 4.5!) aren't supported. There is no scientific-notation view, so very large results are long blocks of digits. Double factorials (n!!) and gamma function values are not calculated.
Assumptions
0! is defined as 1.
Privacy
Factorials are computed in your browser and the values are not sent anywhere or stored.

Frequently asked questions

What is the factorial of 0?+

By mathematical convention, 0! is defined as 1. There is exactly one way to arrange an empty set.

Why do factorials grow so quickly?+

Each step multiplies by a larger number, so the growth outpaces any fixed exponential such as 2^n or 10^n. 10! is about 3.6 million, while 20! is already over 2 quintillion.

What is the largest factorial this calculator supports?+

5000!, which has 16,326 digits. Every digit is computed exactly.

Can I calculate the factorial of a negative number or a decimal?+

No. Factorial is defined for non-negative integers. Decimal values relate to the gamma function, which this tool doesn't compute.

Why does my regular calculator show an error for 171!?+

Standard double-precision numbers top out around 1.8 × 10^308, and 171! is bigger than that. This tool uses arbitrary-precision integers, so it isn't affected.

Related tools