Find the prime factorization of any number with step-by-step factor tree.
Reviewed by the CalculatorKosh Editorial TeamUpdated June 2026Free ยท No sign-up
Prime Factorization Calculator
Find the prime factorization of any number with step-by-step factor tree.
Enter a positive whole number greater than 1
How It Works
Prime factorization (also called integer factorization) expresses any whole number greater than 1 as a product of prime numbers โ numbers like 2, 3, 5, 7 and 11 that have no divisors other than 1 and themselves. This calculator takes an integer from 2 up to 1,000,000, finds its complete prime factorization, tells you whether the number is itself prime, and shows the step-by-step factor tree it used to get there. It is built for students learning number theory, anyone simplifying fractions, square roots or ratios, and people who need to find a greatest common factor (GCF) or least common multiple (LCM) reliably.
The result is meaningful because of the Fundamental Theorem of Arithmetic: every integer greater than 1 has exactly one prime factorization, ignoring the order of the factors. That uniqueness is what makes the prime factorization such a useful fingerprint of a number. For example, 360 always breaks down to 2ยณ ร 3ยฒ ร 5 and nothing else. The same idea underpins modern cryptography โ RSA encryption is secure precisely because multiplying two large primes is fast while factoring their product back apart is, with current methods, computationally infeasible.
How it works
The method is trial division. Starting from the smallest prime, 2, you repeatedly check whether it divides the number evenly. Each time it does, you record that prime as a factor and replace the number with the quotient. When 2 no longer divides cleanly, you move on to 3, then 5, 7 and so on. You only ever have to test divisors up to the square root of the current value: if no prime below the square root divides it, whatever is left must itself be prime. The process stops when the quotient reaches 1, and the list of recorded primes โ written with exponents for repeats โ is the answer.
Worked example
Take 72. Divide by 2: 72 รท 2 = 36. Again: 36 รท 2 = 18. Again: 18 รท 2 = 9. Now 2 no longer divides evenly, so move to 3: 9 รท 3 = 3, then 3 รท 3 = 1. We used 2 three times and 3 twice, so 72 = 2ยณ ร 3ยฒ. A factor tree shows the same thing visually: split 72 into 8 ร 9, then 8 into 2 ร 2 ร 2 and 9 into 3 ร 3 โ the leaves of the tree are exactly the prime factors.
Using it for GCF and LCM
Once you have the prime factorizations of two numbers, comparing exponents gives you both GCF and LCM instantly. For the GCF, take the smallest exponent of each shared prime; for the LCM, take the largest exponent of every prime that appears in either number. For instance, 12 = 2ยฒ ร 3 and 18 = 2 ร 3ยฒ, so the GCF is 2ยน ร 3ยน = 6 and the LCM is 2ยฒ ร 3ยฒ = 36.
Tips and common mistakes
A frequent slip is treating 1 as a prime โ it is not, and a prime factorization never includes a factor of 1. Likewise, the number you start with must be a positive integer greater than 1; decimals are floored to a whole number before factoring. Remember that the exponent notation is just shorthand for repetition: 2ยณ means 2 ร 2 ร 2 = 8, so 2ยณ ร 3ยฒ is 8 ร 9 = 72, not 2 ร 3 added in some way. If the calculator reports a number as prime, it genuinely has no factors other than 1 and itself โ that is the correct, complete answer, not a sign that factoring failed.
Frequently Asked Questions
Prime factorization is writing a number as a product of prime numbers. Every composite number has exactly one prime factorization (ignoring order). For example: 12 = 2ยฒ ร 3, 100 = 2ยฒ ร 5ยฒ, 360 = 2ยณ ร 3ยฒ ร 5. Prime numbers have only one prime factor โ themselves.
Part of Algebra & Numbers Calculators โ compare every related calculator in one place.