# What is the factorial of n?

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.

- Page: https://www.acalculator.org/math/factorial-calculator
- JSON spec: https://www.acalculator.org/math/factorial-calculator.json
- Version: 8d6e55a03f53

## Default answer

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

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| n | n | A whole number from 0 to 1,000. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| factorial | n! | n × (n − 1) × … × 2 × 1, exactly; 0! = 1. |
| approx | In scientific notation | n! to 6 significant digits, shown when it has more than 15 digits. |
| digits | Digits | How many digits n! has. |
| zeros | Trailing zeros | How many zeros n! ends with: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. |
| product | Product | The factors multiplied, from n down to 1. |

## Method

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

## Assumptions

- 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.

## Worked examples

1. n = 5 gives factorial = 120, digits = 3, 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 factorial = 1, digits = 1, 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 factorial = 362,880, 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 approx = 1.55112 × 10²⁵, digits = 26, 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 approx = 9.33262 × 10¹⁵⁷, digits = 158, 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).

## FAQ

### 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.

## Sources

- 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)
- OpenStax, Algebra and Trigonometry 2e, §13.5 Counting Principles (9! = 362,880 orders; factorials in permutations). https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-5-counting-principles (retrieved 2026-10-02)
