About the Prime Factorization Calculator
Every whole number above 1 is built from primes, and there is only one way to build it. 360 is 2 × 2 × 2 × 3 × 3 × 5, and no other combination of primes gives
- Find them in any order you like — you will always end up with the same set.
That guarantee has a name: the fundamental theorem of arithmetic. It is why primes are called the building blocks of the number system, and why "the prime factorisation" is a definite thing rather than one answer among several.
This calculator breaks a number down, shows each division as it happens, and gives you three things the factorisation makes easy: the exponent form, every divisor, and how many divisors there are.
How to Use the Prime Factorization Calculator
Enter a whole number of 2 or more. Anything up to a trillion works.
Press Calculate. You get:
- the prime factorisation in exponent form, such as 2³ × 3² × 5
- the same thing written out in full, as a plain product
- the number of divisors, computed from the exponents rather than by counting
- every divisor, listed in order
The working shows the division ladder: each step divides by the smallest prime that fits, which is exactly what a factor tree does, written vertically.
1 is refused, with an explanation — see the FAQ, because the reason is interesting rather than arbitrary.
How Prime Factorisation Is Calculated
The method is trial division, and it is refreshingly simple.
Start with the smallest prime, 2. Divide as many times as it goes exactly. Then try 3, then 5, then 7, and so on. Each time a prime divides, record it and carry on with the quotient. Stop when the number left is 1.
360 / 2 = 180
180 / 2 = 90
90 / 2 = 45 (2 no longer fits)
45 / 3 = 15
15 / 3 = 5 (3 no longer fits)
5 / 5 = 1
Collect the divisors used: 2, 2, 2, 3, 3, 5 — that is 2³ × 3² × 5.
There is one shortcut that makes this fast enough for very large numbers. You only need to test primes up to the square root. If nothing below √n divides it, nothing above will either, because factors come in pairs — if a × b = n and both exceeded √n, their product would exceed n. So whatever remains once you pass the square root is itself prime, and you can stop.
For a twelve-digit number that means testing up to a million rather than a trillion. It is the difference between instant and impossible.
Counting divisors falls straight out of the factorisation. A divisor of 360 can take 0, 1, 2 or 3 copies of the 2; independently 0, 1 or 2 copies of the 3; independently 0 or 1 copy of the 5. Multiply the choices:
(3 + 1) x (2 + 1) x (1 + 1) = 4 x 3 x 2 = 24
360 has exactly 24 divisors, and you know that without listing one of them.
Prime Factorization Formula
n = p₁^a1 x p₂^a2 x ... x pₖ^ak unique for every n > 1
Number of divisors:
d(n) = (a1 + 1)(a2 + 1)...(ak + 1)
Sum of divisors:
σ(n) = Π (p^(a+1) - 1) / (p - 1)
Trial division limit:
test primes up to √n only
The factorisation also gives the GCF and LCM of two numbers directly. Line up the factorisations and take the shared primes at their lowest power for the GCF, or all primes at their highest power for the LCM.
Step-by-Step Example
Factorise 360.
Step 1 — start with 2. It divides three times:
360 -> 180 -> 90 -> 45
45 is odd, so 2 is finished.
Step 2 — try 3. It divides twice:
45 -> 15 -> 5
5 is not divisible by 3.
Step 3 — try 5. It divides once, leaving 1.
Step 4 — collect. 2 appeared three times, 3 twice, 5 once:
360 = 2³ x 3² x 5
Step 5 — check. 8 × 9 × 5 = 360. ✓
Now a case where the square-root shortcut earns its keep. Factorise 6,000,018.
6000018 / 2 = 3000009
3000009 / 3 = 1000003
Now test 1,000,003. Its square root is about 1,000. Testing every prime up to 1,000 — around 168 of them — finds nothing. So 1,000,003 is prime, and:
6000018 = 2 x 3 x 1000003
Without the shortcut you would be testing a million candidates instead of a hundred and sixty-eight.
Understanding Your Result
The prime factorisation in exponent form is the compact, standard way to write it. This is the form to use when comparing two numbers.
Written out in full is the same thing as a plain product, which makes the multiplication checkable at a glance.
The number of divisors is computed from the exponents, so it is available even when the list is too long to display. A number with many small prime factors has a great many divisors: 720,720 has 240.
All divisors is the complete list in ascending order, truncated in the middle when long. It always starts at 1 and ends at the number itself.
A few things the result quietly tells you. If the factorisation is a single prime to the power 1, the number is prime. If every exponent is even, the number is a perfect square. If there are exactly two prime factors, it is a semiprime — the shape RSA keys take.
When Should You Use This Calculator?
Finding the GCF or LCM by hand. Factorising both numbers makes both answers visible at once.
Simplifying fractions and surds. √72 simplifies because 72 = 2³ × 3², and the pair of 2s and pair of 3s can come out.
Checking divisibility. A number divides another exactly when its factorisation is contained in the other's.
School exercises. Factor trees are a standard topic, and the ladder here is the same method written vertically.
Understanding cryptography. RSA multiplies two large primes and publishes the product. Its security is the claim that no one can run this calculator backwards at that scale.
Number puzzles. Perfect numbers, abundant numbers and divisor counts all start from the factorisation.
Common Mistakes
Treating 1 as a prime. It is not, and the reason is that including it would break uniqueness. If 1 were prime, 6 could be 2 × 3, or 1 × 2 × 3, or 1 × 1 × 2 × 3, endlessly. Excluding it keeps every factorisation single.
Stopping before the number reaches 1. Keep dividing until nothing is left but
- Stopping at a composite means the factorisation is incomplete.
Forgetting to reuse a prime. 2 goes into 360 three times, not once. Divide by the same prime until it no longer fits before moving on.
Testing every number instead of every prime. Once 2 is exhausted, no even number can divide. Testing 4, 6 and 8 wastes effort.
Testing past the square root. Once you pass √n, whatever remains is prime. Continuing is harmless but pointless, and for large numbers it is the difference between seconds and hours.
Counting divisors by listing them. The exponent formula is faster and does not risk missing one. Listing is a check, not a method.
Expecting large numbers to factorise instantly. There is no known fast general method. A 600-digit semiprime is beyond every computer on earth, and that fact is what secures most of the internet.