❗ Factorial Calculator

Compute n! exactly for any non-negative integer using BigInt precision — see the multiplication chain, digit count, and double factorial.

❗ Factorial Calculator
Result
n!
Digit Count
Double Factorial (n!!)

Enter a non-negative integer to compute its exact factorial

Guide

About the Factorial Calculator

Last updated: July 2026 · Reviewed by the NeftCal editorial team

This free factorial calculator computes n! exactly for any non-negative whole number, using JavaScript's BigInt arithmetic so every digit stays precise no matter how enormous the result gets. Factorial — the product of all whole numbers from n down to 1 — is one of the fastest-growing functions in elementary mathematics: 10! is already 3,628,800, and 100! is a 158-digit number. Because ordinary floating-point numbers lose exact precision well before that point, this exact factorial calculator uses BigInt to guarantee every digit is correct, whether you're checking 5! for a homework problem or computing 500! for a combinatorics proof. It also computes the related double factorial (n!!) and shows the full multiplication chain for smaller values.

What This Factorial Calculator Computes

Enter any non-negative integer n (0 up to 5,000) and the calculator returns n! computed with exact BigInt precision, along with its total digit count. For n ≤ 10 it also displays the full multiplication chain (e.g. 5! = 5×4×3×2×1 = 120) so you can follow every step. Alongside the standard factorial, it computes the double factorial n!!, which multiplies every other integer down to 1 or 2 instead of every integer.

Who Should Use This Calculator

This tool is built for students learning combinatorics, permutations, and combinations; teachers preparing probability worksheets; competitive-exam candidates who need instant, exact factorial values; programmers verifying a custom factorial function; and anyone curious how large a factorial gets before it becomes an impractically large number to write out by hand.

Why Factorials Matter

Factorials count the number of ways to arrange a set of distinct items in order — 5! = 120 ways to arrange 5 books on a shelf, for example. This makes factorial the foundation of permutations (nPr) and combinations (nCr), which in turn underpin probability theory, statistics, and much of discrete mathematics. Factorials also appear in the denominators of Taylor and Maclaurin series expansions (for e^x, sin x, cos x), where their rapid growth is exactly what makes those infinite series converge.

Real-World Applications

Combinatorics and probability problems use factorials to count arrangements and outcomes. Computer science courses use factorial growth to illustrate algorithmic complexity, especially for brute-force permutation-based algorithms. Statisticians use factorials inside the binomial and Poisson probability formulas. Double factorials show up in trigonometric integral reduction formulas and Gaussian integral expansions used in physics and statistics.

Tips for Accurate Results

  • Only enter non-negative whole numbers — factorial is undefined for negative integers and non-integers in this calculator.
  • Remember that 0! = 1 by definition, not 0 — this trips up many learners the first time they see it.
  • For very large n (above roughly 20), expect the digit count to grow into the hundreds or thousands — this is normal, not an error.
  • Keep n at or below 5,000 for instant results — that single factorial already has over 16,000 digits.
  • Don't confuse double factorial (n!!) with applying factorial twice, i.e. (n!)! — they are very different operations.
Formula

The Factorial Formula, Explained

How this factorial calculator turns n into n! and n!! with exact precision

Factorial
n! = n × (n−1) × (n−2) × … × 2 × 1

Special Case
0! = 1 (by definition)

Double Factorial
n!! = n × (n−2) × (n−4) × … down to 2 (if n is even) or 1 (if n is odd)

Where:
n = a non-negative whole number (0 to 5,000 in this tool).
n! = n factorial, the product of every whole number from 1 to n.
n!! = n double factorial, the product of every second whole number down to 1 or 2.
🧮

Recursive Definition

n! = n × (n−1)!, with the base case 0! = 1 — this recursive relationship is how factorial is formally defined in mathematics.

📈

Explosive Growth

Factorial grows faster than exponential functions — 10! = 3,628,800, but 20! already exceeds 2.4 quintillion.

🔢

BigInt for Exactness

JavaScript's regular Number type loses precision past 2^53 (~9 quadrillion); BigInt keeps every digit of even a 16,000-digit result exact.

⚙️ Why This Formula Works

Factorial counts the number of distinct orderings of n items: the first position can be filled n ways, the second n−1 ways (since one item is used), and so on down to 1 way for the last position. Multiplying these choices together — n × (n−1) × … × 1 — gives the total count of possible arrangements, which is exactly n!.

🎯 When to Use It

  • Counting the number of ways to arrange or order a set of distinct items
  • Computing permutations (nPr) and combinations (nCr) for probability problems
  • Evaluating terms in a Taylor/Maclaurin series expansion

📋 Assumptions

  • n is a non-negative whole number — decimals and negatives are not valid inputs
  • n is capped at 5,000 to keep browser computation fast
  • 0! is treated as 1, consistent with standard mathematical convention

⚠️ Limitations of the Formula

  • Undefined for negative integers and non-integers under this basic definition (the Gamma function extends it, but is outside this tool's scope)
  • Results grow so fast that display must truncate or format extremely large numbers for readability
  • Double factorial is a distinct operation from applying factorial twice — n!! ≠ (n!)!
Walkthrough

Step-by-Step: How to Use the Factorial Calculator

From entering n to reading the exact result

Enter a non-negative integer

Type a whole number n from 0 up to 5,000 into the input field.

Click "Calculate"

The calculator multiplies every whole number from n down to 1 using BigInt arithmetic for exact precision.

Read the exact factorial value

Smaller results display in full; very large results are truncated for display, with the full value available and the digit count shown.

Check the digit count

See exactly how many digits the result has — factorials grow far faster than most people expect.

Review the double factorial (n!!)

See the product of every other integer down to 1 or 2, shown alongside the standard factorial.

Verify with the multiplication chain

For n ≤ 10, review the full multiplication chain to confirm the calculation step by step.

Example

Worked Example

Computing 7! and 7!! step by step

Scenario

How many ways can 7 distinct books be arranged on a shelf, and what is the double factorial 7!! used for comparison?

n7
7!5,040
7!!105
Step 1 — List every whole number from 7 down to 1: 7, 6, 5, 4, 3, 2, 1.
Step 2 — Multiply them all together: 7×6 = 42; 42×5 = 210; 210×4 = 840; 840×3 = 2,520; 2,520×2 = 5,040; 5,040×1 = 5,040.
Step 3 — Result: 7! = 5,040, meaning there are 5,040 distinct ways to arrange 7 distinct books in a row.
Step 4 — Compute the double factorial 7!!: multiply every other number down from 7: 7×5 = 35; 35×3 = 105; 105×1 = 105.
Step 5 — Result: 7!! = 105, which is much smaller than 7! since it skips every other factor.
7!
5,040
7!!
105
Digit Count of 7!
4

Explanation: 7! answers "how many ways can 7 distinct items be ordered?" while 7!! is a different, smaller quantity that only multiplies alternating terms. The two are easy to confuse by notation alone, which is why this calculator always displays them side by side.

Interpretation

Understanding Your Factorial Result

What each output actually represents

OutputWhat It MeansExample
n!The total number of ways to arrange n distinct items in order5! = 120 → 120 ways to arrange 5 items
Digit CountHow many digits the exact factorial has — a measure of how large the result is100! has 158 digits
n!! (double factorial)The product of every other integer down to 1 or 2 — not the same as (n!)!6!! = 6×4×2 = 48
0!Defined as 1 by convention, representing the single way to arrange zero items0! = 1

Reading truncated results: when a factorial's exact value has more digits than fit comfortably on screen, this calculator shows the leading and trailing digits with the full digit count noted, and the complete exact value remains available in the scrollable box below.

Typical ranges: factorial grows super-exponentially — each increase of n by 1 multiplies the result by n, so digit count roughly follows n×log₁₀(n) for large n.

Manual verification: for small n, multiply the chain of numbers by hand (n × (n−1) × … × 1) and confirm it matches the calculator's output exactly — there should be no rounding involved at any step.

Use Cases

Practical Use Cases for the Factorial Calculator

Where exact factorial values are genuinely useful

🎓

School & college combinatorics

Practice permutations, combinations, and counting problems that build directly on factorial.

📝

Competitive exam prep

Get instant, exact factorial values for probability and counting questions under time pressure.

🎲

Probability & statistics

Compute arrangements and outcome counts inside binomial and Poisson probability formulas.

💻

Computer science coursework

Illustrate algorithm complexity for brute-force permutation-based algorithms that scale as O(n!).

📐

Series expansions

Evaluate factorial terms in Taylor and Maclaurin series for e^x, sin x, and cos x.

🧮

Combinations & nCr calculations

Use factorial as the building block of the combinations formula nCr = n!/(r!(n−r)!).

🧑‍💻

Programmer verification

Sanity-check a custom factorial function against exact BigInt-computed reference values.

🔬

Physics & engineering

Use double factorials in Gaussian integral expansions and trigonometric reduction formulas.

🧩

Puzzles & recreational math

Explore how quickly factorial grows and compare it to exponential and polynomial functions.

📊

Data science & sampling

Compute the number of possible orderings or samples for combinatorial data analysis.

🧑‍🏫

Teaching aid

Generate instant, exact factorial worked examples for classroom demonstrations.

🎮

Game & puzzle design

Calculate the total number of arrangements possible in card games, puzzles, or seating charts.

Pros & Cons

Advantages and Limitations

What this factorial calculator does well, and where it has boundaries

✅ Advantages

  • Free, instant, and requires no signup or account
  • Uses BigInt arithmetic for exact precision, with no floating-point rounding errors
  • Handles n up to 5,000, producing results with over 16,000 digits
  • Shows the full multiplication chain for n ≤ 10 for step-by-step learning
  • Computes the related double factorial (n!!) alongside the standard factorial
  • Displays the exact digit count of every result
  • Runs entirely in your browser — no data ever leaves your device
  • Removes manual multiplication errors for larger values of n
  • Useful across school, competitive exam, and programming contexts
  • Fast-loading and fully mobile-friendly
  • Consistent, deterministic results every time
  • Free to use as many times as needed, with no calculation limit

⚠️ Limitations

  • Only accepts non-negative whole numbers — no decimals or negative values
  • Capped at n = 5,000 to keep the browser responsive
  • Very large factorials are truncated for on-screen display (though the full digit count and exact scrollable value are still shown)
  • Does not extend factorial to non-integers via the Gamma function
  • Multiplication chain display is limited to n ≤ 10 for readability
  • Does not compute permutations (nPr) or combinations (nCr) directly — only the underlying factorial
  • Growth is so fast that comparing factorials of very different n visually can be misleading without the digit counts
Reference

Factorial vs Double Factorial vs Permutations vs Combinations

Four closely related counting concepts, compared

ConceptFormulaWhat It Counts
Factorial (n!)n × (n−1) × … × 1Ways to arrange all n distinct items in order
Double Factorial (n!!)n × (n−2) × (n−4) × …Product skipping every other integer; appears in series and pairing counts
Permutations (nPr)n! ÷ (n−r)!Ordered arrangements of r items chosen from n
Combinations (nCr)n! ÷ (r! × (n−r)!)Unordered selections of r items chosen from n

Common Mistakes and Expert Tips

❌ Common Mistakes

  • Thinking 0! = 0 instead of the correct 0! = 1
  • Confusing double factorial (n!!) with applying factorial twice, i.e. (n!)!
  • Trying to compute a factorial for a negative number or a decimal like 2.5!
  • Using regular floating-point arithmetic for large n, which silently loses precision beyond 2^53
  • Forgetting that factorial growth is much faster than exponential growth, leading to underestimating result size
  • Mixing up permutations (order matters) and combinations (order doesn't matter) when applying factorial-based formulas

💡 Expert Tips & Best Practices

  • Use BigInt (or an equivalent exact-arithmetic library) whenever computing factorials above roughly 18! in code
  • Pair this tool with the Prime Number Checker when studying number theory alongside combinatorics
  • Use the Sequence & Series Calculator when a factorial term appears inside a series you need to sum
  • Double-check whether a problem calls for permutations or combinations before applying a factorial-based formula
  • Cross-reference with the Binary/Hex Converter when a factorial-scale number needs to be represented in a different base for a computing context
📝

Summary: This factorial calculator gives you an instant, exact way to compute n! and n!! for any non-negative integer up to 5,000, backed by BigInt precision so every digit stays correct. Pair it with the Prime Number Checker and Sequence & Series Calculator for a fuller toolkit of number theory and combinatorics calculators.

FAQ

Frequently Asked Questions

Common questions about factorials

What is a factorial?
The factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 up to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials grow extremely fast — 10! is already 3,628,800.
What is 0 factorial (0!)?
By definition, 0! = 1. This convention makes formulas in combinatorics and probability (like combinations and permutations) work correctly for the empty case.
What is a double factorial?
A double factorial, written n!!, is the product of every other integer from n down to 1 or 2. For example, 6!! = 6 × 4 × 2 = 48 and 7!! = 7 × 5 × 3 × 1 = 105. It is not the same as applying factorial twice.
How large can factorials get?
Extremely large. 20! is already over 2.4 quintillion, and 100! has 158 digits. This calculator uses JavaScript's BigInt type to compute exact results (not floating-point approximations) for values of n up to 5,000.
Why does this calculator use BigInt instead of regular numbers?
JavaScript's regular Number type loses precision beyond about 2^53 (roughly 9 quadrillion), which factorials exceed by around 18!. BigInt represents integers of arbitrary size exactly, so every digit of a huge factorial like 1000! stays accurate instead of rounding to an approximation.
Is factorial defined for negative numbers?
Not for whole numbers — factorial is only defined for non-negative integers (0, 1, 2, ...) in the standard definition used here. The Gamma function extends the concept to negative and non-integer values, but that is a separate, more advanced tool outside this calculator's scope.
Why is factorial undefined for decimals like 2.5!?
The basic factorial definition is a product of whole numbers counting down to 1, which only makes sense for integers. A decimal like 2.5 doesn't fit that counting pattern. The Gamma function generalizes factorial to non-integers, but ordinary factorial notation (n!) is reserved for whole numbers.
What is the relationship between factorials and permutations?
The number of ways to arrange n distinct items in order (permutations) is exactly n!. For example, there are 5! = 120 ways to arrange 5 books on a shelf. Factorials are also the denominator building blocks in the combinations formula, nCr = n! / (r!(n−r)!).
How is 0! = 1 useful in formulas?
Defining 0! = 1 keeps combinatorics formulas consistent for the "empty case." For example, choosing 0 items from a set (nC0) should equal 1 (there's exactly one way to choose nothing), and the combinations formula only gives that answer correctly if 0! = 1.
What is the largest n this calculator supports?
This tool computes factorials for n up to 5,000. At that size, the result already has over 16,000 digits — pushing much higher would slow down the browser noticeably, since factorial computation time grows with n.
How many digits does 100 factorial (100!) have?
100! has 158 digits. It starts with 93326215443944152681... and ends in 24 zeros, because every multiple of 5 up to 100 contributes trailing zeros when paired with factors of 2 in the product.
Why does a factorial end in so many trailing zeros?
Trailing zeros come from factors of 10 (2×5) in the product. Since factors of 2 are far more common than factors of 5 among the numbers 1 to n, the count of trailing zeros equals the count of factor-5s, computed as ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ... For 100!, that sums to 24 trailing zeros.
Where do double factorials show up in practice?
Double factorials appear in trigonometric integral reduction formulas, the Gaussian (normal distribution) integral expansions, and counting problems like the number of ways to pair up 2n objects, which equals (2n−1)!!.
What is the factorial of a very small number like 1! or 2!?
1! = 1 (just the number 1 itself) and 2! = 2 × 1 = 2. These small cases, along with 0! = 1, are the base cases that the general n! = n × (n−1)! recursive definition builds up from.
How does factorial relate to Taylor series like e^x?
Factorials appear in the denominators of Taylor and Maclaurin series expansions, such as e^x = 1 + x + x²/2! + x³/3! + ... The rapid growth of n! in the denominator is precisely what makes these infinite series converge to a finite value.
Learn More

Authoritative Resources on Factorials

Trusted educational references to go deeper on combinatorics and factorials

Related Calculators

Explore other math tools