Factorial Calculator
Calculate the factorial of any number online with support for large values. Free factorial calculator for math and combinatorics work.
How to Use Factorial Calculator
Enter a number
Type any positive integer or zero. The tool calculates n! immediately.
View result
The output shows the full factorial value, scientific notation for large values, and optionally the intermediate steps (such as 5×4×3×2×1=120).
Compare with related
The tool may also show the 0! through n! sequence, a growth comparison, and related calculations like combinations and permutations.
Use in math problems
Apply the results to probability calculations, combinatorics, programming verification, and mathematical homework.
When to Use Factorial Calculator
Mathematical computations and combinatorics
Combinatorics, probability, and permutations all rely heavily on factorials. The tool computes n! quickly for any non-negative integer n, which fits homework problems, prepared classroom examples, calculations of combinations and permutations in research, partition function work in physics, and statistical analysis of sample arrangements.
Programming and algorithm verification
Comparing your code's output against known factorial values is a fast way to verify an implementation. The tool helps with testing recursive against iterative implementations, debugging factorial-based algorithms, exploring algorithmic complexity through factorial growth, validating combinatorial code in production, comparing BigInt and standard integer overflow behavior, and providing reference values for computer science coursework. Edge cases like 0!, 1!, and very large factorials are worth testing explicitly.
Probability and statistics calculations
The permutations formula P(n,r) = n!/(n-r)! and the combinations formula C(n,r) = n!/(r!(n-r)!) both depend on factorials. The tool produces accurate n! values that feed into these formulas, which is useful in statistics coursework, gambling odds, decision theory, lottery probability, card game mathematics, dice combination analysis, and anything that involves counting arrangements or selections from sets.
Educational learning and mathematical exploration
Factorials grow at a startling rate. 5! is just 120, but 10! is already 3.6 million, 15! climbs over a trillion, and 20! exceeds 2.4 quintillion. The tool reveals this growth interactively, which helps students learn combinatorics, visualize rapid-growth functions, understand why factorial complexity is impractical for large n in algorithms, and grasp how quickly counting problems run past computational feasibility.
Factorial Calculator Examples
Simple factorial
5!5! = 5 × 4 × 3 × 2 × 1 = 120A basic factorial: 5 × 4 × 3 × 2 × 1 = 120. This pattern shows up in probability problems, permutation counting, and basic combinatorics.
Larger factorial
20!20! = 2,432,902,008,176,640,000 (~2.43 × 10^18)20 factorial reaches 2.4 quintillion, which approaches the limits of 64-bit integer arithmetic. Anything larger requires BigInt support, which the tool typically provides.
Stirling approximation
100! approximatedExact: huge number (158 digits). Stirling: ~9.33 × 10^157.Stirling's approximation says n! ≈ √(2πn)(n/e)^n, and it shines for very large factorials where exact computation is impractical. It comes up regularly in physics, statistics, and complexity analysis.
Tips & Best Practices for Factorial Calculator
- 1.Factorial grows extremely fast. 10! is 3.6 million, 20! is 2.4 quintillion, and 100! has 158 digits. Watch for overflow in your implementation.
- 2.Use BigInt when the inputs get large. Standard 32-bit and 64-bit integers overflow around 12! and 20! respectively, while JavaScript's BigInt handles arbitrary size.
- 3.0! equals 1 by definition. This is easy to forget, and it shows up naturally in combinations where C(n,0) = 1.
- 4.Negative factorials are undefined. Real-valued factorials extend through the Gamma function, where Γ(n+1) = n!, but that goes beyond the scope of a basic factorial calculator.
- 5.When you actually need probability calculations, look for combinations or permutations tools directly — they tend to be more useful than raw factorial.
- 6.Stirling's approximation, n! ≈ √(2πn)(n/e)^n, is accurate for large n and useful whenever an exact value is impractical to compute.
Frequently Asked Questions
Related Tools
Date Calculator
Calculate date differences and add or subtract days, months, and years online. Free date calculator with weekday and holiday support.
Percentage Calculator
Calculate percentages online with increase, decrease, and ratio modes. Free percentage calculator for discounts, tips, and math.
Aspect Ratio Calculator
Calculate aspect ratios and scale dimensions proportionally online. Free aspect ratio calculator for images, video, and screen sizes.
Sales Tax Calculator
Calculate sales tax amounts and total prices online. Free sales tax calculator with pre-tax and post-tax price breakdown support.
Age Calculator
Calculate your exact age from birthdate in years, months, and days online. Free age calculator with upcoming birthday countdown.
Temperature Converter
Convert between Celsius, Fahrenheit, and Kelvin online. Free temperature converter with instant results and conversion formulas.