How to use the factorial calculator
Enter a whole number, choose a calculation mode, and select Calculate. The Result panel shows the selected mode, the exact integer, its digit count, and the formula steps. Factorial (n!) multiplies the whole numbers from 1 through n; Subfactorial (!n) counts arrangements in which no item stays in its original position.
- Enter a whole number from 0 through 10,000 in
Number (n). - Choose
Factorial (n!)orSubfactorial (!n). - Select
Calculate. - Read the value of n, mode, result, digit count, and calculation steps in
Result. - Select
Copy resultorDownload result (.txt)to keep the generated plain-text calculation.
What Factorial (n!) and Subfactorial (!n) calculate
Factorial multiplies each whole number from 1 through n. Enter 5 in Number (n) with Factorial (n!) selected and the result is:
n = 5
Mode: Factorial (n!)
Result: 5! = 120
The calculator defines 0! = 1. Subfactorial uses !n = (n - 1) x (!(n - 1) + !(n - 2)), starting with !0 = 1 and !1 = 0. For n = 5, Subfactorial (!n) returns !5 = 44.
For n through 15, Formula & steps shows the expanded values. For larger n, it shows the formula, a calculation summary, and the final exact integer.
What inputs does the factorial calculator accept?
Enter digits only in Number (n). Empty input, negative signs, decimals, and values above 10,000 produce an error. The calculator does not evaluate Gamma-function values or other non-integer extensions.
The calculation uses JavaScript BigInt arithmetic, so the integer result stays exact. The result text for Copy result and Download result (.txt) is assembled in the browser from the values on the page.
Where factorial and derangement numbers come up
- To count arrangements of 7 distinct books, enter 7, choose Factorial (n!), and read the exact result, 5040.
- For 5 items with no item in its original position, choose Subfactorial (!n) and get
!5 = 44. - For a worksheet, enter a value, review the displayed steps, and select Download result (.txt) to save the formula and result as plain text.
When another math calculator fits better
Use this page for one factorial or derangement calculation. For unordered selections of r items from n, use the Combination Calculator. For ordered arrangements of r items from n, use the Permutation Calculator. For GCF, LCM, prime factorization, or modular arithmetic, use the Number Theory Calculator or browse Math Calculators.
Frequently asked questions
How do I calculate n factorial?
Enter n in Number (n), select Factorial (n!), and select Calculate. The Result panel shows n!, its digit count, and the calculation steps.
What does a subfactorial calculator find?
It finds !n, the number of derangements of n items. Select Subfactorial (!n) to apply the recurrence from !0 = 1 and !1 = 0.
Can I calculate 0! and !0?
Yes. Both return 1. Enter 0 in Number (n), choose the required mode, and select Calculate.
Can this derangement number calculator use decimals?
Number (n) accepts whole numbers from 0 through 10,000. Decimals, negative values, empty input, and values above 10,000 show an error.
What does Formula & steps show for large factorials?
For n through 15, it shows expanded intermediate values. For larger n, it shows the formula, a calculation summary, and the final exact result.