Pick the type with the five buttons at the top: Basic (n!), Double (n!!), Subfactorial (!n), Multifactorial (n(k)!) or Primorial (n#). Learn more about the types
Click Calculate. The result appears after the equals sign; results beyond 21 digits switch to scientific notation. Learn more about results
The panel under the form explains the chosen type, and its link opens the section below that treats it in full. Hover over a ? icon for a short hint. Learn more about the panel
Click Reset to clear the boxes and the result and return to Basic. A red message replaces the result when n is negative or not a number. Learn more about messages
The basic factorial (n!) is the product of all positive integers less than or equal to n. For example, 5!=5×4×3×2×1=120. By convention, 0!=1. Factorials grow extremely rapidly and are fundamental in combinatorics, probability, and algebra. Learn more about factorials
The factorial calculator offers five different types at the top: Basic (n!), Double (n!!), Subfactorial (!n), Multifactorial (n(k)!), and Primorial (n#). Start by clicking one of these radio buttons to select which type you want to calculate.
For most calculations, you'll use Basic (n!)—the standard factorial that multiplies all numbers from 1 to your number. Click this option and you'll see one input box asking for your number. Enter any whole number from 0 upward.
The other types are specialized: Double for even/odd sequences, Subfactorial for counting arrangements, Multifactorial for custom step sizes (requires two inputs), and Primorial for prime number products. Select the type that matches your problem.
After entering your number (and k value for multifactorial), click the blue Calculate button. Your result appears on the right side of the equals sign, for example 6!!=48 with Double selected. The panel under the form explains the chosen type, and a ? icon next to each box shows a hint. Use Reset to clear everything, return to Basic and start over; a red message such as Error: Invalid input replaces the result when n is negative or not a number. What a factorial is, and why 0!=1, is explained in what are factorials.
Using Basic Factorial
DemoBasic factorials, small and large
Step 0 of 5
Basic (n!) is the most common type. Select this radio button at the top, then enter a whole number in the box. Try 5—click Calculate and see 120 appear as the result because 5!=5×4×3×2×1=120.
Start with small numbers to understand the pattern. Calculate 3! and get 6 (because 3×2×1=6). Then try 4! for 24, 6! for 720, and 7! for 5040. Notice how quickly factorials grow—each new number multiplies the previous result.
Special case: Enter 0 and get 1. This isn't a mistake—by mathematical definition, 0!=1. This convention makes many formulas work correctly. Similarly, 1!=1 because there's only one number to multiply.
The calculator prints results up to 21 digits in full: 20!=2432902008176640000, about 2.4 quintillion. Longer results switch to scientific notation, so 25! appears as 1.5511210043330985984e+25, meaning 1.5511×1025. Beyond 170! the calculator shows the result as a power of e, such as evalue. How fast the numbers grow is shown in how factorials grow.
Calculating Double Factorials
DemoEven and odd double factorials
Step 0 of 5
Select Double (n!!) when you need to multiply only even numbers or only odd numbers. This type skips every other number. For even inputs, it multiplies all even numbers; for odd inputs, it multiplies all odd numbers.
Try 8!! by entering 8 with Double selected. The result is 384 because 8!!=8×6×4×2=384. Notice it skips all odd numbers (7,5,3,1). Each step goes down by 2 instead of 1.
For odd numbers, try 7!! and get 105 because 7!!=7×5×3×1=105. This skips all even numbers (6,4,2). The pattern depends on whether your starting number is even or odd.
Small examples: 4!!=4×2=8, 5!!=5×3×1=15, 6!!=6×4×2=48. Double factorials appear in physics formulas, probability calculations, and certain mathematical sequences. The definition and the link to ordinary factorials are in double factorials.
Working with Subfactorials
DemoCounting derangements
Step 0 of 5
Subfactorial (!n) counts arrangements where nothing stays in its original position—called derangements. Select this type and enter a number to see how many ways you can rearrange items so each one moves.
Start with !3 (enter 3 with Subfactorial selected). The result is 2 because there are exactly 2 ways to arrange three items (A,B,C) so none stay in place: (B,C,A) and (C,A,B). Try placing each letter—neither arrangement leaves any letter in its original spot.
Try !4 and get 9. For four items, there are 9 derangements out of the 24 total arrangements (which is 4!). The subfactorial is always less than the regular factorial because it counts only specific arrangements, not all of them.
Examples: !2=1 (only one way to swap two items), !5=44, !6=265. Subfactorials are used in probability (like the "hat check problem") and combinatorics when calculating arrangements with restrictions. The formula behind the count is in subfactorials and derangements.
Understanding Multifactorial
DemoA step size of your own
Step 0 of 5
Multifactorial (n(k)!) lets you choose your step size. Instead of going down by 1 (basic) or 2 (double), you can go down by any number k. This option requires two inputs: n (your starting number) and k (your step size).
Select Multifactorial and two boxes appear. Enter 10 in the first box and 3 in the second. Click Calculate to see 280 because 10(3)!=10×7×4×1=280. Each step subtracts 3: start at 10, then 7, then 4, then 1.
When k=1, multifactorial equals basic factorial: 5(1)!=5!=120. When k=2, it equals double factorial: 8(2)!=8!!=384. Multifactorial generalizes both of these.
Try 12 with k=4: get 12(4)!=12×8×4=384. Or 9 with k=3: get 9(3)!=9×6×3=162, and 10 with k=4: 10(4)!=10×6×2=120. Choose k based on the pattern you need—it controls which numbers get multiplied together. Where the product stops is explained in multifactorials.
Computing Primorials
DemoProducts of primes
Step 0 of 5
Primorial (n#) multiplies only prime numbers up to n. Select this type and enter a number—the calculator finds all primes less than or equal to your number and multiplies them together.
Try 10# by entering 10 with Primorial selected. The result is 210 because the primes up to 10 are 2,3,5,7, and 2×3×5×7=210. The calculator automatically identifies primes and skips composite numbers like 4,6,8,9,10.
Small examples: 5#=2×3×5=30, 7#=2×3×5×7=210, 11#=2×3×5×7×11=2310. Notice 7# and 10# are the same because there are no primes between 7 and 10.
If you enter a prime number itself, it includes that prime. Try 13# and get 30030 because it multiplies all primes up to and including 13: 2×3×5×7×11×13=30030. Primorials are used in number theory and studying prime distributions, as explained in primorials.
What Are Factorials
A factorial takes a number and multiplies it by every positive whole number below it, all the way down to 1. The symbol is an exclamation mark: n! means "multiply n by all smaller positive integers."
For example, 4! means 4×3×2×1=24. You start at 4, multiply by 3 to get 12, multiply by 2 to get 24, multiply by 1 (which doesn't change anything) to get 24. Every step multiplies by the next smaller number.
Factorials count how many ways you can arrange things. If you have 4 books, there are 4!=24 different ways to order them on a shelf. First book has 4 choices, second has 3 remaining choices, third has 2, last has 1—multiply these together.
Why does 0! equal 1? By definition, there's exactly one way to arrange zero items: do nothing. This might seem strange, but it makes mathematical formulas work correctly. Think of it as the "empty arrangement"—there's one way to arrange nothing.
In the calculator this is the Basic (n!) type. Counting arrangements is the subject of permutation (full), and the reason the choices multiply is the multiplication rule.
Double Factorials
The double factorial n!! multiplies n by every second number below it, down to 2 or 1: 8!!=8×6×4×2=384 and 7!!=7×5×3×1=105. An even n collects the even numbers, an odd n the odd ones. By convention 0!!=1 and (−1)!!=1.
The two kinds fit together: n!=n!!×(n−1)!!, so 8!=8!!×7!!=384×105=40320. For an even number there is a closed form, (2k)!!=2k×k!: 8!!=24×4!=16×24=384. For an odd number, (2k+1)!!=2k×k!(2k+1)!: 7!!=16×35040=105.
Double factorials count the ways to pair up 2k objects, (2k−1)!!, and appear in the integrals of powers of sine and cosine. The common mistake is to read n!! as (n!)!: 3!! is 3×1=3, while (3!)!=6!=720.
The subfactorial !n counts the derangements of n objects: the arrangements in which no object stays in its own place. For three letters A,B,C there are 3!=6 arrangements, and only (B,C,A) and (C,A,B) move every letter, so !3=2.
The formula comes from inclusion and exclusion: !n=n!(1−1!1+2!1−3!1+⋯±n!1). For n=4: 24(1−1+21−61+241)=24×249=9. A quicker recurrence is !n=(n−1)(!(n−1)+!(n−2)): !5=4×(9+2)=44. The first values are !1=0, !2=1, !3=2, !4=9, !5=44, !6=265.
The bracket converges to 1/e, so !n is the integer nearest to n!/e: 24/2.71828≈8.83, which rounds to 9. That is the hat-check result: when n people take hats at random, the chance that nobody gets their own is about 1/e≈0.3679, whatever n is. The common mistake is to expect !n to be a fixed fraction of n! that shrinks; it settles near 0.37.
The multifactorial n(k)!, also written n!(k) or with k exclamation marks, multiplies n by every k-th number below it while the factor stays positive: 10(3)!=10×7×4×1=280, 12(4)!=12×8×4=384, 9(3)!=9×6×3=162.
The product stops at the last factor above 0: from 9 in steps of 3 the next factor would be 0, so the product ends at 3; from 10 it ends at 1. The ordinary factorial is the case k=1 and the double factorial the case k=2: 5(1)!=120 and 8(2)!=8!!=384.
Multifactorials appear when a product skips a fixed number of terms, for example in the coefficients of certain series and in counting problems that pair, triple or group objects in a cycle. The common mistake is to include 0 or a negative factor and get 0; the product never goes below 1. The step k must be a positive whole number; the calculator refuses other values with Error: Invalid k value.
Primorials
The primorial n# is the product of all prime numbers up to n: 10#=2×3×5×7=210, 13#=2×3×5×7×11×13=30030. Composite numbers are skipped, so the primorial changes only when n reaches a new prime: 7#, 8#, 9# and 10# are all 210.
Primorials grow much more slowly than factorials, 10!=3628800 against 10#=210, because only the primes contribute. They are the smallest numbers divisible by every prime up to n, which makes them useful as moduli in sieves and in Euclid's argument that the primes never end: n#+1 is divisible by no prime up to n, so a larger prime must exist.
The common mistake is to multiply every number up to n, which is n!, or to leave out 2 because it is even; 2 is prime and always the first factor. The calculator tests each number for primality before multiplying, so the result is exact up to 1000# and shown as a power of e beyond that.
Factorials get big extremely fast. Look at this pattern: 1!=1, 2!=2, 3!=6, 4!=24, 5!=120, 6!=720, 7!=5040. Each new factorial multiplies the previous one by the next number. Going from 6! to 7! means multiplying 720 by 7.
By 10! you reach 3,628,800—over three million. By 15! you're at 1,307,674,368,000—over a trillion. By 20! you hit 2,432,902,008,176,640,000—that's 2.4 quintillion. The numbers become so large that writing them fully is impractical.
This rapid growth is why the calculator switches to scientific notation once a result passes 21 digits. When you see 1.5511e+25, that's 1.5511×1025: 1.5511 followed by 21 more digits. Beyond 170! the calculator shows enumber format instead.
Practical limit: Most real-world factorial problems use numbers under 20. Calculating 70! gives a number with over 100 digits. Only specialized applications (like cryptography or advanced statistics) work with such enormous factorials. The count that grows this fast, the number of orderings of n items, is explained in permutation (full).
Simple Factorial Patterns
Multiplying factorials: To go from one factorial to the next, just multiply by the next number. Since 5!=120, you know 6!=120×6=720. And 7!=720×7=5040. Each factorial builds on the previous one.
Dividing factorials: When you divide factorials, numbers cancel. 3!5!=3×2×15×4×3×2×1=5×4=20. The 3! cancels out, leaving only the top numbers. This simplifies many calculations.
Factorials in fractions: The expression (n−2)!n! equals n×(n−1). Try with 5: 3!5!=6120=20=5×4. This pattern appears in permutation formulas.
Zero factorial rule: Remember 0!=1, not 0. This makes formulas work: the binomial coefficient (0n)=0!×n!n!=1×n!n!=1. If 0! were 0, you'd divide by zero and the formula would break. The quotient (n−r)!n! is the subject of partial permutation without repetition, and the binomial coefficient of its definition.
Practice Problems to Try
Basic factorials: Calculate 3!, 6!, and 9!. Answers: 6 (because 3×2×1=6), 720, and 362,880. Verify each by multiplying all numbers from your starting point down to 1.
Zero and one: Find 0! and 1!. Both equal 1. Remember this special case—it's used constantly in formulas and calculations.
Double factorials: Compute 6!! and 9!!. Answers: 48 (because 6×4×2=48) and 945 (because 9×7×5×3×1=945). Even numbers give smaller results than odd numbers at the same starting point.
Subfactorials: Find !4 and !5. Answers: 9 and 44. These count derangements—arrangements where nothing stays in place.
Primorials: Calculate 12# and 15#. Answers: 2310 (multiply primes 2,3,5,7,11) and 30030 (multiply primes 2,3,5,7,11,13). List the primes first, then multiply.
Multifactorial: Compute 15(5)! (step by 5). Answer: 15×10×5=750. More counting problems with full solutions are in derangement and permutations and combinations.
Where Factorials Are Used
Counting arrangements: If you have 5 different books, there are 5!=120 ways to arrange them on a shelf. First position has 5 choices, second has 4 remaining, third has 3, fourth has 2, last has 1. Multiply: 5×4×3×2×1=120.
Probability calculations: Drawing cards, rolling dice, or picking lottery numbers all use factorials. The number of ways to choose 3 items from 10 is 3!×7!10!=120. This formula appears everywhere in probability.
Password combinations: A 4-digit PIN where no digit repeats has 10×9×8×7=5040 possibilities—that's 6!10!. Security systems use factorial calculations to measure password strength.
Tournament scheduling: Arranging 8 teams in a bracket uses factorial math. The number of possible matchup orders is related to 8!, though the actual formula is more complex. Sports schedulers use these calculations.
Combination Calculator uses factorials to count selections. The formula for choosing r items from n is r!(n−r)!n!. This calculator helps you compute combinations without calculating each factorial separately.
Permutation Calculator also uses factorials for counting arrangements where order matters. The formula (n−r)!n! counts ways to arrange r items from n total items.
Binomial Coefficient (written (kn)) equals k!(n−k)!n! and appears in probability, Pascal's triangle, and the binomial theorem. Understanding factorials is essential for working with binomial coefficients.
Gamma Function extends factorials to non-integer values. While regular factorials only work for whole numbers, the gamma function Γ(n)=(n−1)! works for any number. This appears in advanced calculus and statistics.
For deeper learning, explore permutations and combinations, probability theory, binomial theorem, and how factorials appear in mathematical series and approximations.