Factor Calculator

About this calculator

Type a positive whole number and get every factor of it, all of its factor pairs and its prime factorization. The calculator also tells you whether the number is prime.

It uses BigInt arithmetic, so integers up to 18 digits are handled exactly.

A positive whole number up to 18 digits.
Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

What is a factor?

A factor of a whole number n is any whole number that divides n exactly, leaving no remainder. Because 12 ÷ 4 = 3 with nothing left, 4 is a factor of 12, and so is 3. Every positive integer has at least two factors, 1 and itself, and 1 is the only number with just one.

Factors, divisors and multiples

Factor and divisor mean the same thing. Multiples run the other way: 12 is a multiple of 4 because 4 × 3 = 12. If a is a factor of b, then b is a multiple of a.

Factor pairs

Factors always come in pairs whose product is the number. For 120, the pairs are 1 × 120, 2 × 60, 3 × 40, 4 × 30, 5 × 24, 6 × 20, 8 × 15 and 10 × 12. You only need to test divisors up to the square root of the number, because every factor above the square root pairs with one below it. When a number is a perfect square, such as 36, the middle pair repeats (6 × 6) and the total count of factors is odd.

Prime factorization

Primes are the building blocks: a prime has exactly two factors, 1 and itself. Every whole number greater than 1 can be written as a product of primes in exactly one way, apart from order. For 120 that product is 2 × 2 × 2 × 3 × 5, or 23 × 3 × 5.

Counting factors from the exponents

Once you have the prime factorization p1a × p2b × ..., the number of factors is a shortcut formula:

Number of factors = (a + 1) × (b + 1) × ...

For 120 = 23 × 31 × 51 that is 4 × 2 × 2 = 16 factors. The sum of the factors can be found the same way: (1 + 2 + 4 + 8) × (1 + 3) × (1 + 5) = 15 × 4 × 6 = 360.

Worked example: factors of 60

DivisorPair
11 × 60
22 × 30
33 × 20
44 × 15
55 × 12
66 × 10

The square root of 60 is about 7.7, so we stop after 6 (7 does not divide 60). The twelve factors are 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 and 60, and the prime factorization is 22 × 3 × 5.

Divisibility shortcuts

  • 2: the last digit is even.
  • 3: the digits add up to a multiple of 3.
  • 5: the last digit is 0 or 5.
  • 9: the digits add up to a multiple of 9.
  • 10: the last digit is 0.

Large numbers

For big inputs the calculator uses exact BigInt arithmetic, tests small primes first, then applies a primality test and a splitting method to whatever is left. That lets it factor 18-digit numbers in a fraction of a second, which would be hopeless by trial division on paper.

Perfect, abundant and deficient numbers

Adding up the proper factors (all factors except the number itself) sorts every number into a category. If the total equals the number, it is perfect: 6 = 1 + 2 + 3 and 28 = 1 + 2 + 4 + 7 + 14. If the total is larger, the number is abundant (12 gives 16). If it is smaller, the number is deficient (every prime gives 1). The factor sum shown in the results lets you place any number in these categories at a glance by subtracting the number from the sum.

Tips for reading the output

  • A prime shows exactly two factors and a single-node tree.
  • Powers of a prime, such as 64 = 26, have a factor for each exponent from 0 to 6, so seven factors in all.
  • Numbers with many small prime factors, like 720, have lots of factors, which is why such numbers are popular for calendars and measurement systems.

Frequently asked questions

How do you find all the factors of a number?

Test every integer from 1 up to the square root of the number. Each one that divides evenly gives you a pair: the divisor and the quotient.

What are the factors of 120?

1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60 and 120. That is 16 factors.

Is 1 a prime number?

No. A prime needs exactly two distinct factors, and 1 has only one.

Why do perfect squares have an odd number of factors?

Because one factor pairs with itself (the square root), so the usual pairing leaves a single unpaired middle value.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.