acalculator

What is the factorial of n?

Type a whole number n from 0 to 1,000. The factorial calculator gives n! with every digit, the number of digits, how many zeros it ends with, and the value in scientific notation.

Your numbers

n!
3,628,800

10! = 3,628,800.

Digits
7
Trailing zeros
2
Product
10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1

n!: 3,628,800. 10! = 3,628,800.

How to calculate

Computes n! exactly for any whole number from 0 to 1,000, with the number of digits, the trailing zeros and the value in scientific notation.

Example with the default inputs (n 10): 10! = 3,628,800.

Method: n! = n × (n − 1) × … × 2 × 1, with 0! = 1; trailing zeros ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ….

  • n is a whole number from 0 to 1,000.
  • n! is exact (every digit); the scientific form is rounded half up to 6 significant digits.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. n 5 gives n! 120, Digits 3, Trailing zeros 1, Product 5 × 4 × 3 × 2 × 1.Source: OpenStax, Algebra and Trigonometry 2e, §13.1 Sequences and Their Notations (0! = 1, 1! = 1, n! = n(n − 1)(n − 2)⋯(2)(1) for n ≥ 2; 4! = 24, 5! = 120, 7! = 5,040), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-1-sequences-and-their-notations (retrieved 2026-10-02)
  2. n 0 gives n! 1, Digits 1, Trailing zeros 0.Source: OpenStax, Algebra and Trigonometry 2e, §13.1 Sequences and Their Notations (0! = 1, 1! = 1, n! = n(n − 1)(n − 2)⋯(2)(1) for n ≥ 2; 4! = 24, 5! = 120, 7! = 5,040), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-1-sequences-and-their-notations (retrieved 2026-10-02)
  3. n 9 gives n! 362,880, Trailing zeros 1.Source: OpenStax, Algebra and Trigonometry 2e, §13.5 Counting Principles (9! = 362,880), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-5-counting-principles (retrieved 2026-10-02)
  4. n 25 gives In scientific notation 1.55112 × 10²⁵, Digits 26, Trailing zeros 6, Product 25 × 24 × 23 × … × 2 × 1.Source: OpenStax, Algebra and Trigonometry 2e, §13.1 Sequences and Their Notations (0! = 1, 1! = 1, n! = n(n − 1)(n − 2)⋯(2)(1) for n ≥ 2; 4! = 24, 5! = 120, 7! = 5,040), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-1-sequences-and-their-notations (retrieved 2026-10-02)
  5. n 100 gives In scientific notation 9.33262 × 10¹⁵⁷, Digits 158, Trailing zeros 24.Source: OpenStax, Algebra and Trigonometry 2e, §13.1 Sequences and Their Notations (0! = 1, 1! = 1, n! = n(n − 1)(n − 2)⋯(2)(1) for n ≥ 2; 4! = 24, 5! = 120, 7! = 5,040), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-1-sequences-and-their-notations (retrieved 2026-10-02)

How it works

  • Factorial: 0! = 1, 1! = 1, and n! = n × (n − 1) × (n − 2) × … × 2 × 1 for n ≥ 2. Computed exactly with whole-number arithmetic, so every digit is right.
  • Digits: the number of digits of n! written in base 10.
  • Trailing zeros: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ⌊n/625⌋ (Legendre’s formula for the prime 5; there are always more factors of 2 than of 5).
  • Scientific notation: when n! has more than 15 digits, its first 7 digits are rounded half up to 6 significant digits and written d.ddddd × 10ᵉ, where e is the number of digits minus 1 (trailing zeros of the 6 digits are dropped; if rounding gives 10.0000, it becomes 1 × 10ᵉ⁺¹).
  • Product: the factors from n down to 1, joined by ×. Up to 12 factors are all written; above that, the first three, then …, then 2 × 1. For 0 it reads “0! = 1 (the empty product)” and for 1 it reads “1”.

Rules

  • n is a whole number from 0 to 1,000. Other values get a field message.

Output format. n! is a whole number with thousands separators. The scientific form uses superscript digits for the power of 10.

Worked examples by hand

5! = 5 × 4 × 3 × 2 × 1 = 120: 3 digits, ⌊5/5⌋ = 1 trailing zero.

0! = 1 (1 digit, no zeros).

9! = 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 362,880, with ⌊9/5⌋ = 1 trailing zero.

25! = 15,511,210,043,330,985,984,000,000: 26 digits, ⌊25/5⌋ + ⌊25/25⌋ = 5 + 1 = 6 trailing zeros, 1.55112 × 10²⁵ (the first 7 digits 1551121 round to 155112).

100! has 158 digits and ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24 trailing zeros; it is 9.33262 × 10¹⁵⁷.

Other questions people ask

What is a factorial?

n factorial, written n!, is the product of the whole numbers from n down to 1. So 5! = 5 × 4 × 3 × 2 × 1 = 120 and 4! = 24.

Why is 0! equal to 1?

0! is the product of no numbers, and an empty product is 1. It also keeps n! = n × (n − 1)! true at n = 1, since 1! = 1 × 0!. OpenStax defines 0! = 1 and 1! = 1.

What are factorials used for?

Counting arrangements. There are n! ways to put n different things in order: 9 books on a shelf can stand in 9! = 362,880 orders. Permutations and combinations are built from factorials.

How many zeros does n! end with?

Count the factors of 5 in 1 to n, since each pairs with a factor of 2 to make a 10: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. For 100! that is 20 + 4 = 24 zeros.

How big is 100!?

100! has 158 digits, about 9.33262 × 10¹⁵⁷. Factorials grow faster than powers: 25! already has 26 digits.

Can I take the factorial of a negative number or a decimal?

Not on this page: n! is defined for whole numbers 0, 1, 2, …. The gamma function extends it to other numbers (Γ(n + 1) = n!), but negative whole numbers have no factorial at all.

Why stop at 1,000?

1,000! has 2,568 digits, which is about as much as a page can show clearly. Every digit shown is exact.