All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Image Tools Video Tools Audio Tools Subtitle Tools Font Tools
Analyze Tools Clean Tools Compress Tools Convert Tools Edit Tools Extract Tools Generate Tools Merge Tools Organize Tools Redact Tools Repair Tools Split Tools
Analyze Tools Clean Tools Compare Tools Convert Tools Extract Tools Generate Tools Merge Tools Transform Tools Validate Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

Factorial Calculator

Find the factorial (n!) or subfactorial (!n) of a nonnegative integer from 0 through 10,000. Enter n, choose a mode, and see the formula, calculation steps, and exact result.

A whole number from 0 through 10,000.

n is treated as a plain count - the calculator does not attach a unit. The result is a pure whole number (a count of orderings or arrangements), not a currency, weight, or other measured unit.

What This Tool Does

Use this calculator to find n! (factorial) or !n (subfactorial, the derangement number) for a nonnegative whole number from 0 through 10,000. It returns an exact integer result.

Factorial counts ordered arrangements of n distinct items. Subfactorial counts derangements: arrangements in which no item stays in its original position.

Formulas and Calculation Steps

For factorial, the tool uses:

n! = n × (n - 1) × (n - 2) × ... × 1, with 0! = 1 by definition (the empty product).

For subfactorial, it uses the recurrence !n = (n - 1) × (!(n - 1) + !(n - 2)), starting from !0 = 1 and !1 = 0. The calculation uses arbitrary-precision BigInt arithmetic, so the integer result is exact.

For inputs through n = 15, Formula & steps shows the expanded intermediate values. For larger inputs, it shows the formula, a calculation summary, and the final result.

Inputs and Validation

  • Enter digits for n, from 0 through 10,000. It is treated as a plain count with no unit.
  • Choose Factorial (n!) or Subfactorial (!n).
  • Negative signs and decimals are rejected. An error appears when n is empty, invalid, or above 10,000.

How to Use the Factorial Calculator

  1. Enter a value in n.
  2. Choose Factorial (n!) or Subfactorial (!n).
  3. Select Calculate.
  4. Review the Result panel and Formula & steps. The panel shows n, the selected mode, the result, and its digit count.
  5. Select Copy result to copy the generated plain-text result and steps.
  6. Select Download result (.txt) to create factorial-calculator-result.txt.
  7. Select Reset to clear n, restore Factorial (n!), clear errors, and hide the result.

Limits and Calculation Privacy

The calculator accepts only whole numbers from 0 through 10,000. It does not calculate Gamma-function values, negative or non-integer factorials, or specialized derangement constraints beyond the standard definition.

The calculation runs in your browser using the local calculator script. That script creates the copy and download text from the calculated result.

Frequently Asked Questions

What is a factorial?

The factorial of a nonnegative integer n, written n!, is the product of all whole numbers from 1 up to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition, 0! = 1.

What is a subfactorial (derangement number)?

The subfactorial of n, written !n, counts the number of derangements - permutations of n items in which no item ends up in its original position. It is computed with the recurrence !n = (n - 1) × (!(n - 1) + !(n - 2)), starting from !0 = 1 and !1 = 0.

What is 0 factorial?

0! equals 1. This is a mathematical convention: the factorial of 0 is defined as the empty product, and an empty product is always 1.

Why do factorials grow so fast?

Each additional term multiplies the running product by a larger number, so factorials grow faster than exponential functions. 20! already exceeds 2.4 quintillion, and 100! has 158 digits.

Can factorials be calculated for negative numbers or non-integers?

The standard factorial n! is only defined for nonnegative integers using the product formula. Negative integers have no factorial, and non-integer values require the Gamma function, which this calculator does not compute - it accepts whole numbers from 0 through 10,000 only.

Related Tools

6 views