Prime factorization calculator with factor tree


Enter a whole number of 2 or more and the calculator gives its prime factorization as a product of primes, for example 360 = 2³ × 3² × 5. You get the repeated division table, the factor tree, every divisor with their count and sum, and the simplified square root of the number.
- ✅ Free
- 🔒 No sign-up
- 📱 Works on mobile
- ⚡ Instant results
🔒 Everything runs in your browser. Your data and files never leave your device.
📌 Key facts
- A prime number has exactly two divisors, 1 and itself; there are 25 primes below 100.
- Every integer 2 or greater is a product of primes in exactly one way (the Fundamental Theorem of Arithmetic).
- To test whether n is prime, you only need to check prime divisors up to the square root of n.
- If n = p^a x q^b x r^c, then n has (a + 1)(b + 1)(c + 1) divisors.
- Example: 360 = 2^3 x 3^2 x 5 has (3 + 1)(2 + 1)(1 + 1) = 24 divisors.
How to find the prime factorization of a number
A prime number has exactly two factors: 1 and itself (2, 3, 5, 7, 11…). Every whole number greater than 1 is a product of primes in exactly one way, apart from the order. To find it, divide by the smallest prime that works, then repeat with the quotient until you reach 1.
| Number | Prime divisor |
|---|---|
| 360 | 2 |
| 180 | 2 |
| 90 | 2 |
| 45 | 3 |
| 15 | 3 |
| 5 | 5 |
| 1 |
\[ 360 = 2 \times 2 \times 2 \times 3 \times 3 \times 5 = 2^{3} \times 3^{2} \times 5 \]
Group the repeated primes with exponents. You only need to test primes up to the square root of the number: if none of them divides n, then n is prime.
Divisibility rules that speed things up
| Divisor | Rule | Example |
|---|---|---|
| 2 | the last digit is even | 2,024 ends in 4 |
| 3 | the digit sum is a multiple of 3 | 2 + 0 + 2 + 4 = 8: no |
| 5 | the last digit is 0 or 5 | 1,995: yes |
| 9 | the digit sum is a multiple of 9 | \( 4 + 5 = 9 \), so 45 is divisible by 9 |
| 11 | the alternating digit sum is a multiple of 11 | 1,001: \( 1 - 0 + 0 - 1 = 0 \), yes |
The primes below 50 are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 and 47.
What you can compute from the prime factorization
If \( n = p_{1} \)a × p₂b × …, then:
- the number of divisors is (a + 1)(b + 1)…: for \( 360 = 2^{3} \times 3^{2} \times 5 \) that is \( 4 \times 3 \times 2 = 24 \) divisors;
- the sum of divisors is the product of (p\( k + 1 \) − 1) ÷ (p − 1): for 360, \( 15 \times 13 \times 6 = 1{,}170 \);
- Euler's totient φ(n), the count of integers from 1 to n that share no factor with n, is the product of p\( k - 1 \)(p − 1): \( \varphi (360) = 4 \times 6 \times 4 = 96 \);
- the simplified square root: pull out the squares, \( \sqrt{360} = \sqrt{2^{3} \times 3^{2} \times 5} = 6 \sqrt{10} \);
- the GCF and LCM of several numbers, by comparing exponents.
Prime factorization: the 25 primes below 100
There are 25 prime numbers below 100. Knowing them speeds up factoring.
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97.
The number 2 is the only even prime. So every other even number divides by 2 at least once. Also, 1 is not prime, because it has only one divisor.
Prime factorization: testing a number with its square root
To check whether a number is prime, you do not need to try every divisor. Test the primes up to its square root.
For example, for 97, the square root is about 9.8. So you test 2, 3, 5 and 7. None divides 97, which means 97 is prime.
| Number | Primes to test | Result |
|---|---|---|
| 91 | 2, 3, 5, 7 | 7 x 13: not prime |
| 97 | 2, 3, 5, 7 | Prime |
| 221 | 2, 3, 5, 7, 11, 13 | 13 x 17: not prime |
Prime factorization: counting divisors
The factorization tells you how many divisors a number has without listing them. Add 1 to each exponent, then multiply.
For example, 84 = 2^2 x 3 x 7. So the divisor count is (2 + 1)(1 + 1)(1 + 1) = 12. Likewise, 360 = 2^3 x 3^2 x 5 has 24.
Also, a number is a perfect square when all its exponents are even. For instance, 144 = 2^4 x 3^2 is the square of 12. That property helps you simplify square roots.
Prime factorization: links to other topics
Factoring helps compute the GCF and LCM. For the GCF, take the shared primes with the smallest exponent. For the LCM, take every prime with the largest exponent.
Try the GCF and LCM calculator, reduce a ratio with the fraction calculator, then solve an equation with the equation solver. Finally, the scientific calculator checks powers.
Factoring larger numbers by hand
For a large number, work in a steady order. First, divide by 2 as long as the result stays whole. Next, try 3, then 5, then 7. Then keep going until the quotient is 1. Finally, write the factors with exponents.
For example, 1,260 divides by 2 twice (315), by 3 twice (35), by 5 (7) and by 7. So 1,260 = 2^2 x 3^2 x 5 x 7. Also, stop testing once the divisor squared exceeds what is left. That saves a lot of time. A calculator does it instantly, but doing a few by hand builds number sense.
3 real-life examples
Factor 84
\( \dfrac{84}{2} = 42 \), \( \dfrac{42}{2} = 21 \), \( \dfrac{21}{3} = 7 \), and 7 is prime. So \( 84 = 2^{2} \times 3 \times 7 \). It has \( (2 + 1) (1 + 1) (1 + 1) = 12 \) divisors.
Factor 1,001
1,001 is not divisible by 2, 3 or 5. Try 7: \( 1{,}001 = 7 \times 143 \). Then \( 143 = 11 \times 13 \). So \( 1{,}001 = 7 \times 11 \times 13 \), three different prime factors.
Is 97 prime?
\( \sqrt{97} \approx 9.8 \), so you only need to test 2, 3, 5 and 7. None divides \( 97 (97 = 2 \times 48 + 1 = 3 \times 32 + 1 = 5 \times 19 + 2 = 7 \times 13 + 6) \). So 97 is prime.