Skip to content
DeviceCheckHub

Prime Factorization Calculator

The prime factors of any whole number up to 30 digits, with a factor tree, the division steps, every divisor and a prime check.

Your number

Enter a whole number, such as 360.

How to use the prime factorization calculator

  1. Enter a whole number from 2 up to 30 digits. Commas and spaces are fine.
  2. Read its prime factors in exponent form and written out, whether it is prime, and its nearest primes.
  3. Follow the factor tree and the division steps, and see every divisor, how many there are and what they add up to.

What prime factorization is

A prime number has exactly two factors, 1 and itself: 2, 3, 5, 7, 11, 13 and so on. Every other whole number above 1 is composite and can be broken down into primes. As OpenStax’s Prealgebra puts it, “The prime factorization of a number is the product of prime numbers that equals the number.” For example, 360 = 2 × 2 × 2 × 3 × 3 × 5, which is written more compactly with exponents as 2³ × 3² × 5.

Each number has only one prime factorization, apart from the order of the factors. OpenStax again: “Composite numbers have more than two factors, and every composite number can be written as a unique product of primes.” This is the fundamental theorem of arithmetic, and it is why prime factors are so useful for fractions, roots and divisibility.

The factor tree method

“One way to find the prime factorization of a number is to make a factor tree.” Write the number at the top and split it into any two factors, then keep splitting each composite factor until every branch ends in a prime. For 360 you might start with 36 × 10, then 6 × 6 and 2 × 5, and finally 2 × 3 for each 6. Whatever split you begin with, the primes at the ends of the branches are the same: three 2s, two 3s and one 5. The calculator’s tree always splits off the smallest prime, so it reads like a staircase.

The division ladder method

“The ladder method is another way to find the prime factors of a composite number.” Divide by the smallest prime that goes in evenly and write the result below; repeat until you reach 1. For 360: 360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45, 45 ÷ 3 = 15, 15 ÷ 3 = 5 and 5 ÷ 5 = 1. The primes you divided by, 2, 2, 2, 3, 3 and 5, are the prime factors. The calculator shows these steps for your number.

Quick divisibility tests

You only need to try primes up to the square root of the number. If none divides it by then, the number is prime, because any factor larger than the square root would pair with one smaller than it.

Finding every divisor from the prime factors

Prime factors give all the divisors at once. If a number is p^a × q^b × …, it has (a + 1)(b + 1)… divisors, because each divisor uses each prime between 0 and its full number of times. 360 = 2³ × 3² × 5 has 4 × 3 × 2 = 24 divisors, and they add up to 1,170. Numbers whose proper divisors add up to exactly the number itself are called perfect: 6 = 1 + 2 + 3 and 28 = 1 + 2 + 4 + 7 + 14.

Where prime factors are used

Prime factors make many calculations easier. The greatest common factor of two numbers is the product of the primes they share, and the least common multiple uses each prime the most times it appears in either, which is how you find a common denominator for fractions. Square roots simplify by pairing equal primes: √360 = √(2² × 3² × 2 × 5) = 6√10. And the security of much of the internet depends on the fact that multiplying two huge primes is easy while finding them again from the product is extremely hard.

Very large numbers

The calculator divides by every prime up to 2,000,000, proves what is left prime with the Miller–Rabin test, and splits harder cases with Pollard’s rho method. That factors almost any number up to 30 digits in a moment. For example, 2⁶⁷ − 1 = 147,573,952,589,676,412,927, which Frank Nelson Cole famously factored by hand in 1903, comes out as 193707721 × 761838257287 straight away. Only a number made of two very large primes of similar size can resist, and then the calculator says so rather than guessing. The nearest primes to 1,000 are 997 and 1,009.

Greatest common factor and least common multiple

Prime factors make the greatest common factor (GCF) and least common multiple (LCM) easy. Write both numbers as primes: 360 = 2³ × 3² × 5 and 84 = 2² × 3 × 7. For the GCF, take each prime the two numbers share, with the smaller power: 2² × 3 = 12. For the LCM, take every prime that appears in either number, with the larger power: 2³ × 3² × 5 × 7 = 2,520. A handy check is that GCF × LCM = 12 × 2,520 = 30,240, which is 360 × 84.

The same factors simplify fractions and square roots. Dividing the top and bottom of 84/360 by their GCF, 12, gives 7/30. And because 360 = 2³ × 3² × 5 contains the square 2² × 3² = 36, √360 = 6√10.

Your data stays on your device

Everything is worked out in your browser. Nothing you type is sent anywhere or stored.

Frequently asked questions

What is the prime factorization of 360?

360 = 2³ × 3² × 5, or 2 × 2 × 2 × 3 × 3 × 5 written out. It has 24 divisors, from 1 to 360.

How do you find the prime factorization of a number?

Divide by the smallest prime that goes in evenly, starting with 2, then 3, 5, 7 and so on. Keep dividing the result until you reach 1. The primes you divided by are the prime factors.

Is 1 a prime number?

No. A prime has exactly two factors, 1 and itself, and 1 has only one. Leaving 1 out is what makes every whole number’s prime factorization unique.

How do I know if a number is prime?

Check whether any prime up to its square root divides it. If none does, it is prime. To test 97, try 2, 3, 5 and 7, since 11² = 121 is already bigger than 97. None divides it, so 97 is prime. The calculator does this, and uses a faster test for very large numbers.

What is the difference between factors and prime factors?

Factors are all the numbers that divide evenly into a number: 12 has 6, namely 1, 2, 3, 4, 6, 12. Prime factors are only the primes among them, multiplied as often as needed: 12 = 2² × 3.

Is anything I type saved or sent?

No. Everything is worked out in your browser and nothing you type is sent anywhere or stored.

Last updated · About DeviceCheckHub