CalcCafe

Prime Factorization Calculator

Break any whole number down into the product of prime powers that build it.

Prime factorization
2^3 x 3^2 x 5
Distinct primes
3
Prime factors (with multiplicity)
6
Number of divisors
24
Prime?
No

Uses trial division to the square root, so very large integers (above ~10^15) may be slow or limited by floating-point precision. Numbers below 2 have no prime factorization.

Example

Factor 360 by repeatedly dividing out the smallest primes:

360 / 2 = 180
180 / 2 = 90
90 / 2 = 45  -> 2 appears 3 times
45 / 3 = 15
15 / 3 = 5  -> 3 appears 2 times
5  / 5 = 1  -> 5 appears 1 time

360 = 2^3 x 3^2 x 5
Divisors = (3+1)(2+1)(1+1) = 24

How it works

Enter an integer and the tool runs trial division up to its square root, peeling off each prime factor and counting its exponent. The result shows the canonical factorization plus the count of distinct primes and total divisors.

Good to know

This Prime Factorization Calculator takes any whole number and rewrites it as a product of prime powers, such as 360 = 2^3 x 3^2 x 5. Alongside the factorization it reports the number of distinct primes, the total count of prime factors counted with multiplicity, the total number of divisors, and whether the input is itself prime. It is built for students learning number theory, anyone simplifying fractions or finding greatest common divisors and least common multiples, and developers or puzzle-solvers who need a quick, reliable breakdown.

Reach for it whenever a problem hinges on a number's building blocks: reducing a fraction to lowest terms, checking if two numbers are coprime, computing how many factors a number has, or verifying that a candidate is prime. Because it factors into the canonical prime form, the same result feeds directly into LCM and GCD calculations and into divisor-counting questions that show up in exams and coding interviews.

To read the output, treat the exponent on each prime as how many times that prime divides in. The "number of divisors" comes from adding one to each exponent and multiplying those together, so a number's structure, not its size, determines how many factors it has. The "Prime?" field reads Yes only when the factorization is the number itself with exponent one. The accompanying table lists each prime and its exponent so you can copy the parts you need.

One practical caveat: the tool uses trial division up to the square root of the input, which is exact but slows down for very large values, and it stops above roughly 10^15 because standard floating-point numbers lose integer precision past that point. Inputs below 2, including 0, 1, and negatives, have no prime factorization; for a negative number the calculator factors its absolute value and prefixes a minus sign. If your number ends in many zeros or is clearly even, you already know 2 and 5 will appear, which is a quick sanity check on the result.

Frequently asked questions

How is the number of divisors calculated?
If n = p1^a x p2^b x ... then the total number of positive divisors is (a+1)(b+1)... For 360 = 2^3 x 3^2 x 5 that is (3+1)(3)(2) = 24.
Why can't it factor very large numbers instantly?
It uses trial division up to the square root of n, which is exact and reliable but slows for huge inputs. Beyond about 10^15 JavaScript's number precision also breaks down, so the tool stops there.
Is my data uploaded anywhere?
No — this calculator runs entirely in your browser; nothing is uploaded.
Is it free?
Yes, completely free with no sign-up and no limits.

People also ask

What is the prime factorization of a number?
It is the unique way of writing a whole number greater than 1 as a product of prime numbers, for example 84 = 2^2 x 3 x 7. By the fundamental theorem of arithmetic, every integer above 1 has exactly one such factorization apart from the order of the factors.
How do you find the prime factors of a number by hand?
Repeatedly divide by the smallest prime that goes in evenly, starting with 2, then 3, 5, 7 and so on, until you reach 1. Each prime you divide by is a factor, and the number of times you divide by it is its exponent.
Is 1 a prime number or does it have a prime factorization?
No, 1 is not prime and has no prime factors; it is considered the empty product. Primes are defined as integers greater than 1 with exactly two divisors, namely 1 and themselves.
What is the difference between distinct primes and prime factors with multiplicity?
Distinct primes counts each prime once regardless of how often it appears, while prime factors with multiplicity adds up all the exponents. For 360 = 2^3 x 3^2 x 5 there are 3 distinct primes but 3 + 2 + 1 = 6 prime factors with multiplicity.
How is prime factorization used to find the GCD and LCM?
Factor both numbers, then for the GCD multiply each shared prime raised to its smallest exponent, and for the LCM multiply every prime that appears raised to its largest exponent. For example with 12 = 2^2 x 3 and 18 = 2 x 3^2, the GCD is 2 x 3 = 6 and the LCM is 2^2 x 3^2 = 36.
Why is factoring large numbers considered hard?
There is no known fast general method to factor very large integers, and the difficulty grows quickly with size, which is why methods like trial division become impractical. This computational hardness is the basis for cryptographic systems such as RSA.
What does it mean if a number has no factors other than 1 and itself?
That number is prime, meaning its only positive divisors are 1 and the number itself. In that case the prime factorization is simply the number written once with an exponent of 1.

Related calculators