Factorial Calculator

Calculate n! (n Factorial) for any non-negative integer | Step-by-step solution included

💡 n must be a whole number between 0 and 170
Result
--
📝 Step-by-step solution
Enter a number and click "Calculate n!"
💡 n! = n × (n−1) × (n−2) × ... × 2 × 1 | 0! = 1 by definition

📖 What is a Factorial?

The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. It is a fundamental concept in combinatorics, probability, and calculus. Factorials count the number of ways to arrange n distinct objects in a sequence — also known as permutations.

n! = n × (n − 1) × (n − 2) × ... × 2 × 1

Special case: 0! = 1 (by convention)

📝 Worked Example

Example: Calculate 5!
Step 1: Write the product: 5! = 5 × 4 × 3 × 2 × 1
Step 2: Multiply step by step:
    5 × 4 = 20
    20 × 3 = 60
    60 × 2 = 120
    120 × 1 = 120
Result: 5! = 120

📊 Factorial Table (Common Values)

nn!Value
00!1
11!1
22!2
33!6
44!24
55!120
66!720
77!5,040
88!40,320
99!362,880
1010!3,628,800
1515!1,307,674,368,000
2020!2.4329 × 1018
5050!3.0414 × 1064
100100!9.3326 × 10157

🎯 Real-World Applications of Factorials

🧮 Useful Factorial Properties

⚠️ Limitations & Assumptions

📌 Important Notes
  • This calculator uses JavaScript numbers (double precision), which lose accuracy above n = 170.
  • For n > 170, the result overflows to Infinity in JavaScript.
  • For very large n, results are shown in scientific notation (e.g., 1.234e+50).
  • Only non-negative integers are supported. Fractions and negative numbers are not valid in standard factorials.
  • Gamma function extends factorials to real numbers, but this is not implemented here.

📚 References & Sources

Authoritative Sources

  • Weisstein, Eric W. — Factorial, MathWorld
  • NIST Digital Library of Mathematical Functions — Gamma Function
  • Khan Academy — Factorials in Combinatorics
  • Abramowitz & Stegun — Handbook of Mathematical Functions

❓ Frequently Asked Questions

What is 0! (zero factorial)?
By definition, 0! = 1. This is not arbitrary — it makes the recurrence n! = n × (n − 1)! work for n = 1: 1! = 1 × 0!, so 0! must equal 1.
Can factorials be calculated for negative numbers?
No — standard factorials are only defined for non-negative integers. The Gamma function extends factorials to real numbers, but negative integers remain undefined.
Why does 170! overflow?
170! is approximately 7.26 × 10306, which is very close to the maximum double-precision floating point value (~1.8 × 10308). 171! exceeds that limit.
What is the relationship between factorials and permutations?
The number of permutations of n distinct objects is exactly n!. For example, there are 5! = 120 ways to arrange 5 different books on a shelf.
How large is 100!?
100! ≈ 9.3326 × 10157 — a 158-digit number, larger than the number of atoms in the observable universe (approximately 1080).

🔗 Related Calculators

⚠️ Disclaimer
This Factorial Calculator is provided for educational and informational purposes only. Results are computed using JavaScript double-precision floating point arithmetic, which is accurate up to approximately 170!. For very large factorials or precision-critical applications, use dedicated mathematical software such as Wolfram Mathematica, Python's math.factorial, or similar tools. Online Calculator Zone is not responsible for any decisions made based on these calculations.