Skip to main content

Factorial Calculator

Compute n! exactly using BigInt for any 0 ≤ n ≤ 5000, with digit count.

Written by Golam Rabbani, Founder & Lead Engineer

Computes n! for 0 ≤ n ≤ 5000.

How to use this factorial calculator

  1. Enter a non-negative integer n between 0 and 5000.
  2. Press Calculate to compute n! exactly.
  3. Read the digit count and the scientific-notation approximation.
  4. Use Copy to put the exact value on your clipboard, or Reset to clear the input.

About this factorial calculator

The factorial calculator computes n! — the product of every positive integer from 1 up to n. It uses JavaScript BigInt arithmetic, so the result is exact even when n! has hundreds of digits and would overflow ordinary floating-point numbers.

The formula is n! = n × (n − 1) × (n − 2) × … × 1, with the convention 0! = 1. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials grow extremely quickly: 10! is already 3,628,800; 20! exceeds 2 × 10^18 (beyond the safe integer range of a regular number); and 100! has 158 digits. The tool caps the input at n = 5000 to keep the browser responsive — 5000! has 16,326 digits and computing it on demand stays under a second on modern hardware.

Factorials underpin permutations, combinations, probability, series expansions (such as e^x), and many counting problems in maths and statistics.

FAQ

What does the factorial calculator do?
It computes n! — the product of every positive integer from 1 up to n — exactly using BigInt arithmetic. Inputs from 0 to 5000 are supported.
What is the formula for n!?
n! = n × (n − 1) × (n − 2) × … × 1, with the special case 0! = 1 by definition. Each step multiplies the previous result by the next integer down.
Why is the upper limit 5000?
5000! has over 16,000 digits and is computed by an iterative BigInt multiplication. Beyond that the page would start to feel sluggish on slower devices, so the input is capped.
Why does 0! equal 1?
It is the conventional definition that keeps combinatorial formulas consistent — for example, the number of ways to arrange 0 objects is 1 (the empty arrangement), and binomial coefficients require 0! = 1 to behave correctly.
Does this tool store my numbers?
No. The calculation runs entirely in your browser; nothing is sent to a server or saved between visits.
Is the factorial calculator free?
Yes. It is free to use with no signup, no account, and no usage limit.