AbraCalc

Factorial Calculator

Calculate the factorial of any non-negative integer (n!).

Embed this tool on your site
Cite this tool

APA

AbraCalc. (2026). Factorial Calculator [Online calculator]. Retrieved from https://abracalc.com/calculator/factorial-calculator/

BibTeX

@misc{abracalc-factorial-calculator, author = {AbraCalc}, title = {Factorial Calculator}, year = {2026}, howpublished = {\url{https://abracalc.com/calculator/factorial-calculator/}} }

Did this tool answer your question?

How to use this tool

  1. Enter n in the fields above.
  2. Results update instantly as you type — or click Calculate.
  3. Read your n! and the full breakdown beneath it.

Calculate the factorial of any non-negative integer. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.

Formula

n! = 1 × 2 × 3 × … × n

For n = 0 or n = 1: 0! = 1, 1! = 1 (by definition). For any positive integer n: n! = ∏ni=2 i

How it works

The calculator takes the absolute value and rounds the input to the nearest integer, then multiplies all integers from 2 up through n together iteratively to produce n!. This method is exact for small integers but note that JavaScript's floating-point numbers lose precision for very large factorials (roughly n > 18).

Worked example

Worked example: 5!

  1. Start with n = 5.
  2. Multiply: 1 × 2 = 2.
  3. Continue: 2 × 3 = 6.
  4. Continue: 6 × 4 = 24.
  5. Continue: 24 × 5 = 120.

5! = 120

Common mistakes to avoid

  • Entering a negative integer -- factorial is defined only for non-negative integers; a negative input should return an error rather than a numeric result.
  • Confusing n! with n^n -- factorial multiplies descending integers (5! = 120), while n^n raises n to itself (5^5 = 3125); the latter grows far faster.
  • Underestimating how rapidly factorial values grow: 20! exceeds 2.4 quintillion, and standard floating-point arithmetic loses exact integer precision above roughly n = 18-20.

Key terms

Factorial (n!)
The product of all positive integers from 1 up to n. By convention, 0! = 1.
Integer
A whole number with no fractional part (e.g., 0, 1, 2, 3…).
Combinatorics
The branch of mathematics that counts arrangements and selections; factorials appear throughout it.
Overflow
When a computed value exceeds the maximum number a data type can represent; large factorials exceed JavaScript's safe integer range.

Frequently asked questions

What is a factorial?
The factorial of n (written n!) is the product of all positive integers up to n. By definition, 0! = 1.

References & sources