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.
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).
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.