Prime Factorization Calculator

Enter a whole number to find its prime factors, exponent form, factor tree, and division steps. The prime checker is included as a secondary result.

Calculate a prime factorization

Commas, spaces, and underscores are accepted. Decimals are not. Negative integers are shown with a factor of −1; divisor lists use |n|.

Try an example

Results will appear here.

About this calculator

Prime factorization writes a whole number as a product of prime numbers. Every integer greater than 1 has one unique prime factorization, apart from the order of its factors. Prime status is reported alongside the main factorization result.

How to use it

  1. Enter a whole number with an absolute value from 2 through 1 trillion.
  2. Turn on Show Steps first if you want the division table left open.
  3. Select Calculate to get the factorization, factor tree, divisor data, and prime status.
  4. With steps on, select Copy Complete Working to copy every result and recorded division test.

Input limit and calculation method

The calculator uses trial division: it tests 2, 3, and then possible divisors of the form 6k ± 1. Work stops once the next divisor squared exceeds the remaining quotient, because any composite quotient would already have a smaller factor.

Calculation runs locally in a separate Web Worker and is stopped after 5 seconds so a difficult input cannot freeze the page. Large primes and semiprimes near 1 trillion can take longer because trial division may need to test many candidates before finding a factor—or proving there is none.

Advertisement

Prime factorization formula and divisor count

n = p1a1 × p2a2 × … × pkak

Here, n is the number, each pi is a distinct prime factor, each ai is its positive exponent, and k is the number of distinct prime factors.

d(n) = (a1 + 1)(a2 + 1)…(ak + 1)

For 360 = 23 × 32 × 5, the calculator uses the exponents to get d(360) = (3 + 1)(2 + 1)(1 + 1) = 24 positive divisors.

Two manual methods

How to find prime factorization by trial division

Start with the smallest prime and divide repeatedly whenever the result is exact. For 360:

  1. 360 ÷ 2 = 180, 180 ÷ 2 = 90, and 90 ÷ 2 = 45.
  2. 45 ÷ 3 = 15 and 15 ÷ 3 = 5.
  3. The remaining quotient, 5, is prime, so stop.
  4. The recorded factors are 2 × 2 × 2 × 3 × 3 × 5 = 23 × 32 × 5.

Testing only through the square root is enough: if a quotient were composite, one member of a factor pair would be no greater than its square root. Once the remaining quotient is prime, no further split is possible.

How to make a factor tree

Split a composite number into any factor pair, then keep splitting composite branches. For 84:

  1. Split 84 into 2 × 42.
  2. Keep 2 as a prime leaf; split 42 into 2 × 21.
  3. Keep the second 2; split 21 into 3 × 7.
  4. All leaves—2, 2, 3, and 7—are prime, so 84 = 22 × 3 × 7.

Different valid first splits produce different-looking trees, but the prime leaves are always the same, apart from order.

Worked prime factorization examples

NumberRepeated divisionExpanded factorsExponent formCheck
6060 ÷ 2 = 30; 30 ÷ 2 = 15; 15 ÷ 3 = 52 × 2 × 3 × 522 × 3 × 54 × 3 × 5 = 60
8484 ÷ 2 = 42; 42 ÷ 2 = 21; 21 ÷ 3 = 72 × 2 × 3 × 722 × 3 × 74 × 3 × 7 = 84
100100 ÷ 2 = 50; 50 ÷ 2 = 25; 25 ÷ 5 = 52 × 2 × 5 × 522 × 524 × 25 = 100
360360 ÷ 2 = 180; ÷ 2 = 90; ÷ 2 = 45; ÷ 3 = 15; ÷ 3 = 52 × 2 × 2 × 3 × 3 × 523 × 32 × 58 × 9 × 5 = 360
997 (prime)No prime divisor ≤ √997; stop at 31997997997 = 997

Common values

12 = 22 × 3 · 18 = 2 × 32 · 24 = 23 × 3 · 36 = 22 × 32 · 48 = 24 × 3 · 72 = 23 × 32 · 120 = 23 × 3 × 5 · 1,000 = 23 × 53

Practical uses of prime factorization

Find a GCF

84 = 22 × 3 × 7 and 126 = 2 × 32 × 7. Take the smaller shared powers: GCF = 2 × 3 × 7 = 42.

Find an LCM

For 12 = 22 × 3 and 18 = 2 × 32, take the highest power of each prime: LCM = 22 × 32 = 36.

Simplify a fraction

84/126 = (22 × 3 × 7)/(2 × 32 × 7). Cancel 2 × 3 × 7 to get 2/3.

Simplify a radical

√72 = √(23 × 32) = √(22 × 32 × 2) = 6√2.

Prime factorization FAQ

How do you find prime factorization?

Divide the number by the smallest prime that divides it exactly, record that prime, and repeat with the quotient. Stop when the quotient is prime. The recorded primes are the prime factorization.

What is the difference between factors and prime factors?

Factors are all whole numbers that divide a number exactly. Prime factors are only the prime numbers in its multiplicative decomposition. For 12, the factors are 1, 2, 3, 4, 6, and 12, while the prime factors are 2 and 3.

What is a factor tree?

A factor tree repeatedly splits a composite number into two factors until every leaf is prime. Multiplying the prime leaves reconstructs the original number.

Why is 1 not prime?

A prime must have exactly two positive divisors: 1 and itself. The number 1 has only one positive divisor, so it is neither prime nor composite.

Can a prime number be factorized?

Its prime factorization is the prime number itself. For example, the prime factorization of 997 is 997.

How are repeated factors written with exponents?

Count how many times each prime occurs and use that count as its exponent. For example, 2 × 2 × 2 × 3 is 2³ × 3.

How large a number can this calculator handle?

It accepts whole numbers n with 2 ≤ |n| ≤ 1,000,000,000,000. It uses trial division in a Web Worker with a time limit; large primes and semiprimes can be slower because they have no small factor.

Explore more tools