Skip to content

Prime Factorization Calculator

Break a whole number into the prime numbers that multiply together to make it. The answer is shown in exponent form, such as 2³ × 3² × 5 for 360, along with each division step.

From 2 to 1,000,000,000,000.

Prime factorization

2³ × 3² × 5

360 = 2 × 2 × 2 × 3 × 3 × 5. Keep dividing by the smallest prime that fits until the quotient is 1.

Distinct primes
3
Prime factors, with repeats
6
Largest prime factor
5
Is it prime?
No
Factor tree, as repeated division
StepDivide byQuotient
12180
2290
3245
4315
535
651

How to use this calculator

  1. 1 Type a whole number from 2 up to 1,000,000,000,000.
  2. 2 Read the answer in exponent form. The small raised number shows how many times that prime appears.
  3. 3 Open the factor tree table to see each prime you divided by and what was left.

What is a prime number?

A prime number is a whole number greater than 1 that has only two factors: 1 and itself. The first few primes are 2, 3, 5, 7, 11, 13, 17 and 19.

The number 1 is not prime, because it has only one factor. The number 2 is the only even prime, because every other even number is divisible by 2.

A number that is not prime is called composite. For example, 12 is composite, because 2 × 6 = 12 and 3 × 4 = 12.

What is prime factorization?

Prime factorization writes a number as a product of prime numbers. Every whole number greater than 1 can be written this way, and there is only one set of primes for each number, apart from the order.

Take 360. Divide it by 2 three times to get 45. Divide 45 by 3 twice to get 5, which is prime. So 360 = 2 × 2 × 2 × 3 × 3 × 5. In exponent form, that is 2³ × 3² × 5.

The calculator shows the answer in exponent form, and it lists the primes in a table so you can follow the steps.

How the calculator finds the factors

The calculator uses trial division. It tries each prime, starting from 2, and divides the number by it as many times as it goes in. It then moves to the next candidate.

It can stop early. Once the square of the next candidate is bigger than what is left, the remaining number must be prime. For example, to check 91, you only need to test primes up to 9. Since 7 divides 91 as 7 × 13, the factors are 7 and 13.

This method is quick for numbers up to a trillion, which is the limit on this page.

Using prime factors in everyday maths

Prime factors help you simplify fractions. For 12/18, write 12 as 2² × 3 and 18 as 2 × 3². They share 2 × 3 = 6, so the fraction simplifies to 2/3.

They also help you find the greatest common factor and the least common multiple. For 12 and 18, the shared primes give 6 as the greatest common factor. Using the highest powers gives 2² × 3² = 36 as the least common multiple.

For those tasks, the GCF calculator and the LCM calculator give the answers directly.

Why factoring large numbers is hard

Finding the prime factors of a small number is easy. For a large number with two big prime factors, it becomes very hard. That difficulty is why many internet security systems depend on it.

This calculator stops at one trillion, which keeps every answer quick to find.

For a list of factors rather than primes, use the factor calculator.

The formula

Fundamental theorem of arithmetic

n = p₁ᵃ × p₂ᵇ × … × pₖᶜ

p
a distinct prime number, listed from smallest to largest
a, b, c
how many times each prime appears. Every whole number above 1 has exactly one such form

Trial division

Divide n by 2, then 3, 5, 7 and so on, repeating each prime while it fits. Stop when p² is greater than what is left.

p
the candidate divisor
p²
if no prime up to the square root of what is left divides it, what is left is itself prime

Worked example

Prime factors of 360

  1. 1.360 ÷ 2 = 180, then 180 ÷ 2 = 90, then 90 ÷ 2 = 45.
  2. 2.45 ÷ 3 = 15, then 15 ÷ 3 = 5.
  3. 3.5 is prime, so the last division is 5 ÷ 5 = 1.
  4. 4.Collect the primes: 2, 2, 2, 3, 3, 5. Write repeats as powers: 2³ × 3² × 5.

360 = 2³ × 3² × 5, which has 6 prime factors counted with repeats.

Frequently asked questions

What is exponent form?

Exponent form writes each repeated prime as a power. For example, 2 × 2 × 2 is written 2³, which means 2 multiplied by itself three times.

Is the prime factorization of a number unique?

Yes. Apart from the order of the factors, every whole number above 1 has exactly one way to be written as a product of primes. That is the fundamental theorem of arithmetic.

What is a factor tree?

A factor tree splits a number into two factors, then splits each factor again until every branch ends in a prime. This calculator shows the same process as a list of divisions.

Why does the calculator not accept 1?

The number 1 is not prime, and it has no prime factors to list, so the calculator starts at 2.

Sources

Last reviewed by the GridCalculators team.