All tools · Utilities

Factorial

Compute n! for any n up to 170.

Free to use, no sign-up required. Factorial is one of 198 tools built into Xenition, alongside a chat that can use them for you.

Calculates n factorial (n!), the product of every whole number from 1 up to n. It comes up in permutations, combinations and probability homework.

How to use Factorial

  1. Type a whole number n into the box.
  2. Read n! below, printed in full with thousands separators.

How it works

The tool multiplies 2 × 3 × … × n using BigInt, JavaScript’s whole-number type with no fixed size, so every digit is exact rather than rounded like a normal floating-point number. 0! and 1! both give 1. Inputs above 170 show “Too large (max 170)”, and negative numbers show nothing because factorial is not defined for them. A decimal such as 5.7 is read as 5.

Example

10! = 3,628,800, and 20! = 2,432,902,008,176,640,000, which is 19 digits long.

Questions about Factorial

Why is 0! equal to 1?

There is exactly one way to arrange zero items, and defining 0! = 1 keeps formulas like n! = n × (n − 1)! working all the way down.

Why stop at 170?

170! is the largest factorial that fits in a standard floating-point number, which is where many calculators stop. This tool computes exactly with BigInt, but it keeps that same 170 cap, so 170! (a 307-digit number) is the largest it will show.

Use it from chat

You do not have to open Factorial to use it. Ask Xenition in plain language and it runs the right tool, then carries the answer into whatever you are working on — a document, a spreadsheet, a deck.

Related tools