CALCULATORCASTLE

Factor Calculator

Find all factors and prime factors of any whole number.

About

Factor Calculator

Enter any whole number and this calculator returns every factor it has, the factor pairs that multiply to it, and its prime factorisation with a factor tree. For 120 that is sixteen factors, eight pairs, and 120 = 2 × 2 × 2 × 3 × 5. The tree redraws itself for whatever number you type.

What a factor is

A factor of a number is any whole number that divides it with nothing left over. Since 6 × 5 = 30, both 6 and 5 are factors of 30, and so are 1, 2, 3, 10, 15, and 30 itself. Put formally, a is a factor of b when b ÷ a leaves no remainder.

Factors always come in pairs, because division works both ways: if 6 divides 30, then 30 ÷ 6 = 5 is a factor too. Every number has at least two, 1 and itself, and the ones with exactly those two are the primes. Factors are also called divisors, and the two words mean the same thing here.

Finding every factor by hand

The reliable method is to test each whole number from 1 upward and stop at the square root. For 120 you would try 1, 2, 3, 4, 5, 6, 8, 10, and stop once you pass √120 ≈ 10.95. Each hit gives you two factors at once: 1 pairs with 120, 2 with 60, 3 with 40, 4 with 30, 5 with 24, 6 with 20, 8 with 15, and 10 with 12.

Stopping at the square root is not a shortcut that risks missing anything. If a factor larger than √n existed without a partner below it, the two multiplied together would exceed n, which is impossible. That is why the search is over once you reach the root, and it is why testing 120 needs only ten divisions instead of a hundred and twenty.

A few divisibility rules speed the hand version up. A number divides by 2 when it ends in an even digit, by 3 when its digits sum to a multiple of 3, by 5 when it ends in 0 or 5, and by 9 when the digit sum is a multiple of 9. For 120: it is even, its digits sum to 3, and it ends in 0, so 2, 3, and 5 all divide it before you have done any real work.

Factor pairs

Listing factors as pairs makes the structure obvious. The pairs of 120 are (1, 120), (2, 60), (3, 40), (4, 30), (5, 24), (6, 20), (8, 15), and (10, 12). Each multiplies back to 120, and the pairs converge on the square root from both sides.

This is also why perfect squares have an odd number of factors, when every other number has an even count. In 36 the pair (6, 6) is a single number partnered with itself, so 36 has nine factors rather than an even number. Any number with an odd factor count is a perfect square, with no exceptions.

Prime numbers and prime factorisation

A prime has exactly two factors, 1 and itself: 2, 3, 5, 7, 11, 13 and so on. Everything else above 1 is composite. The number 1 is neither, because it has only one factor, and treating it as prime would break the uniqueness described below.

Prime factorisation means writing a number purely as a product of primes. For 120 that is 2 × 2 × 2 × 3 × 5, or 2³ × 3 × 5 in exponent form. Every composite number can be broken down this way, and the primes are where the breaking stops, since they cannot be divided further.

What makes this useful rather than merely tidy is the fundamental theorem of arithmetic: every integer above 1 has exactly one prime factorisation, ignoring the order of the factors. There is no second way to write 120 as a product of primes. That uniqueness is what lets prime factorisations be compared directly, which is how greatest common factors and lowest common multiples are found.

Factor trees

A factor tree is the standard way to work a factorisation out on paper. Split the number into any two factors, then keep splitting whichever branches are still composite, until every leaf is prime.

The tree on this page divides by the smallest prime that fits at each step: 120 ÷ 2 = 60, 60 ÷ 2 = 30, 30 ÷ 2 = 15, then 15 ÷ 3 = 5, leaving 5. Reading the extracted primes down the right gives 2, 2, 2, 3, 5.

You could equally have started 120 = 10 × 12 and split from there. The tree would look completely different and the leaves would still be 2, 2, 2, 3, and 5, which is the uniqueness theorem showing up in practice. Any route through the tree ends at the same multiset of primes.

Counting factors without listing them

Once you have the prime factorisation, the number of factors follows from the exponents alone. Add one to each exponent and multiply the results.

For 120 = 2³ × 3¹ × 5¹, that is (3 + 1) × (1 + 1) × (1 + 1) = 4 × 2 × 2 = 16 factors, which matches the list exactly. The reasoning is that any factor is built by choosing how many 2s to include (none, one, two, or three), how many 3s (none or one), and how many 5s (none or one), so the count is the product of those choices.

The sum of the factors has a matching formula. For each prime raised to a power a, take (pa+1 − 1) ÷ (p − 1) and multiply those together. For 120 that gives 15 × 4 × 6 = 360, again matching the calculator. Both shortcuts stay fast on numbers far too large to list factors for.

Perfect and abundant numbers

Adding a number's factors except itself gives its aliquot sum, and comparing that to the number sorts it into three kinds. When the sum equals the number it is perfect, as with 6 = 1 + 2 + 3 and 28 = 1 + 2 + 4 + 7 + 14. When the sum exceeds it, as with 120, the number is abundant. When the sum falls short it is deficient, which covers every prime, since their only proper factor is 1.

Perfect numbers are rare. The first four are 6, 28, 496, and 8,128, and only 51 are known. Whether any odd perfect number exists is still unsolved after more than two thousand years of looking.

Why factoring large numbers is hard

Trial division is fine up to a point, and this calculator handles anything up to a trillion quickly. Past that the work grows roughly with the square root of the number, so each extra pair of digits multiplies the effort by ten.

No efficient general algorithm for factoring is known, and that gap is load-bearing. RSA encryption rests on it: multiplying two large primes is instant, while recovering them from the product is not. RSA-768, a 232-digit number, took a research team about two years on hundreds of machines. RSA-250 fell in 2020 after roughly 2,700 core-years of computing.

Nobody has proved that no fast algorithm exists either, which leaves the question genuinely open. Shor's algorithm already factors numbers in polynomial time on a quantum computer, so the difficulty is a limitation of classical machines rather than a law of mathematics, and that is precisely why post-quantum cryptography is being standardised now.

Where factors get used

Simplifying fractions is the everyday case: dividing top and bottom by their greatest common factor reduces 120/36 to 10/3. Finding a common denominator to add fractions is the same idea run the other way, through the lowest common multiple.

Beyond arithmetic, factors decide how a quantity can be split evenly, which is why they appear in packing, scheduling, and layout problems. The Prime Factorization Calculator focuses on the prime breakdown alone, the Common Factor Calculator compares two or more numbers, and the LCM Calculator handles the multiple side.

How this calculator works

Factors are found by trial division from 1 up to the square root, recording both members of each pair as they are discovered, then merging the two halves into one sorted list. The prime factorisation is built separately by dividing out the smallest prime that fits, over and over, which is also what produces the step list and the tree.

The limit is a trillion. Above that, trial division would need more than a million steps and the page would stall, so the calculator declines rather than freezing. Zero is rejected too, since every number divides it and the factor list would be infinite. One is accepted and returns a single factor, itself, with no prime factorisation, because 1 is a unit rather than a prime.

Common questions

Frequently asked questions

There are sixteen: 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, and 120. They form eight factor pairs, from (1, 120) up to (10, 12), and the prime factorisation is 2 × 2 × 2 × 3 × 5, written 2³ × 3 × 5.

Test every whole number from 1 up to the square root. Each one that divides evenly gives you two factors at once, itself and the quotient. For 120 you test up to about 10.95, so ten divisions produce all sixteen factors. Nothing above the square root can be missed, because it would already have appeared as a partner.

It is writing a number purely as a product of primes, so 120 becomes 2 × 2 × 2 × 3 × 5. Every integer above 1 has exactly one such factorisation apart from the order, which is the fundamental theorem of arithmetic. That uniqueness is what makes it useful for comparing numbers.

Split the number into any two factors, then keep splitting any branch that is still composite until every leaf is prime. Starting 120 as 2 × 60 or as 10 × 12 gives differently shaped trees, but both end with the same leaves: 2, 2, 2, 3, and 5.

Take the prime factorisation, add one to each exponent, and multiply. For 120 = 2³ × 3¹ × 5¹ that is 4 × 2 × 2 = 16. The sum of the factors has a matching formula, giving 360 for 120, and both work on numbers far too large to list.

Because one of their pairs is a number matched with itself. In 36 the pair (6, 6) counts once rather than twice, leaving nine factors instead of an even count. Any number with an odd number of factors is a perfect square.

No. A prime has exactly two distinct factors and 1 has only one, itself. Excluding it is also what keeps prime factorisation unique, since otherwise you could pad any factorisation with as many 1s as you liked and still call it valid.

No efficient general algorithm is known, and the work grows with roughly the square root of the number. RSA encryption depends on that gap: multiplying two large primes is instant, recovering them is not. RSA-250 was only factored in 2020, after about 2,700 core-years of computing.