Skip to content

Prime Factorization Calculator

Enter a whole number to get its prime factorization in exponent form, a factor tree, the division ladder and a primality check.

MathUpdated Free · No sign-up

How to use the Prime Factorization Calculator

  1. Enter Whole number (2 or more) (Works for any number up to 9,007,199,254,740,991 (253 − 1)).
  2. Read your answer in the results panel. It updates as you type, and the breakdown, step-by-step working and any charts or tables appear below it.
  3. Use Share link to save or send the exact calculation, or Copy to paste the results elsewhere.

What prime factorization means

Every whole number greater than 1 is either prime or can be written as a product of primes in exactly one way, apart from the order. This is the fundamental theorem of arithmetic. For example 1260 = 2 × 2 × 3 × 3 × 5 × 7, which in exponent form is 2² × 3² × 5 × 7.

The division ladder

The most direct method is repeated division by the smallest prime that fits:

  1. 1260 ÷ 2 = 630
  2. 630 ÷ 2 = 315
  3. 315 ÷ 3 = 105
  4. 105 ÷ 3 = 35
  5. 35 ÷ 5 = 7
  6. 7 is prime, so stop.

Reading off the divisors gives the factorization. The calculator lists these steps and also draws the same process as a factor tree, splitting off one prime at each branch until only primes remain.

How the calculator checks for primes

To test whether n is prime you only need to try divisors up to √n: if n had a factor larger than its square root, it would also need a partner smaller than the square root. The calculator tries 2 and 3, then only numbers of the form 6k ± 1 (5, 7, 11, 13, 17, 19, …). Every prime above 3 has that form, so this skips two-thirds of the candidates.

For the largest numbers it accepts, around 9 × 10¹⁵, the square root is about 95 million, so a prime input still needs roughly 30 million trial divisions. That takes well under a second in a modern browser. For example 2⁵³ − 1 = 9,007,199,254,740,991 factors as 6,361 × 69,431 × 20,394,401.

Uses of prime factorization

  • GCF and LCM: take the lowest shared powers for the GCF and the highest powers for the LCM.
  • Counting divisors: add 1 to each exponent and multiply. 1260 has 3 × 3 × 2 × 2 = 36 divisors.
  • Simplifying roots: √1260 = √(2² × 3² × 35) = 6√35.
  • Cryptography: RSA encryption depends on the fact that multiplying two huge primes is easy but factoring the product back is extremely hard. Real RSA keys use numbers hundreds of digits long, far beyond trial division.

Notes

  • 1 has no prime factors and is not prime, so the calculator starts at 2.
  • Numbers above 2⁵³ − 1 cannot be stored exactly as ordinary JavaScript numbers, so they are not accepted.

Frequently asked questions

How do I find the prime factorization of a number?

Divide by the smallest prime that goes in exactly, then repeat with the result until you reach 1 or a prime. The primes you divided by are the prime factors.

Is 1 a prime number?

No. A prime must have exactly two distinct factors, 1 and itself. 1 has only one factor, and excluding it keeps prime factorizations unique.

How do I know if a large number is prime?

Check whether any prime up to its square root divides it. If none does, it is prime. The calculator does this automatically for numbers up to about 9 × 10¹⁵.

Can two different numbers have the same prime factorization?

No. Each whole number greater than 1 has exactly one prime factorization, apart from the order of the factors.