Prime Factorization Calculator

Decompose any positive integer into its prime factors with exponents and a text factor tree.

Result

Prime Factorization
Factor Tree
Is Prime?

What is Prime Factorization?

Prime factorization is the process of breaking a composite number down into the prime numbers that multiply together to make it. A prime number, such as 2, 3, 5, or 7, has no positive divisors other than 1 and itself, so primes act as the building blocks of every integer. The fundamental theorem of arithmetic guarantees that every integer greater than 1 has exactly one prime factorization, ignoring the order of the factors, which is why the result is sometimes called the number's prime decomposition.

Writing a number as a product of primes is more than an academic exercise. It is the standard route to greatest common factors and least common multiples, the cleanest way to reduce fractions, and the foundation of RSA encryption — multiplying two large primes is easy, while factoring their product back apart is extraordinarily hard.

How the Factorization Works

This calculator uses trial division: it divides your number by 2 as many times as possible, then by each odd candidate (3, 5, 7, and so on) up to the square root of whatever remains. If anything is left over at the end, that leftover is itself prime. The result is written in exponential form, and the exponents double as a divisor counter:

n = p1^e1 × p2^e2 × … × pk^ek

Number of divisors = (e1 + 1) × (e2 + 1) × … × (ek + 1)

  • Number — the positive integer you want to factor, from 2 up to 1,000,000,000,000 (1e12), entered as plain digits.
  • Prime Factorization — the prime factors with their exponents, joined by multiplication signs, such as 2^3 × 3^2 × 5.
  • Factor Tree — a text diagram that splits the number step by step until every branch ends in a prime leaf.
  • Is Prime? — Yes when the factorization is a single prime with exponent 1, otherwise No.

Worked Example: Factoring 360

Take 360, the number of degrees in a circle. Trial division pulls out the smallest prime factor at each step:

  • 360 ÷ 2 = 180
  • 180 ÷ 2 = 90
  • 90 ÷ 2 = 45 (2 divides no further)
  • 45 ÷ 3 = 15
  • 15 ÷ 3 = 5
  • 5 ÷ 5 = 1 (done)

That is six divisions producing three 2s, two 3s, and one 5, so 360 = 2^3 × 3^2 × 5. From the exponents you can count the divisors without listing them: (3 + 1) × (2 + 1) × (1 + 1) = 4 × 3 × 2 = 24 divisors.

A prime input behaves differently. Enter 997 and trial division runs all the way to its square root, about 31.58, without finding a factor: 997 leaves a nonzero remainder when divided by every prime from 2 through 31. With no divisor found, the calculator reports 997 as its own only factor and answers Yes to Is Prime?.

Prime Factorizations of Common Numbers

Use this quick-reference table to check homework or spot patterns — powers of 2 factor into nothing but 2s, while highly composite numbers such as 5,040 stack up several small primes.

NumberPrime FactorizationDivisors
602^2 × 3 × 512
1442^4 × 3^215
3602^3 × 3^2 × 524
4622 × 3 × 7 × 1116
1,0002^3 × 5^316
1,0242^1011
5,0402^4 × 3^2 × 5 × 760
997997 (prime)2

How to Use

  1. Type a whole number from 2 up to 1,000,000,000,000 (1e12) into the Number field.
  2. Click Calculate. If the entry is not a valid integer in that range, the input is highlighted as invalid.
  3. Read the prime factorization with exponents, the text factor tree, and whether the number is prime.
  4. Click Reset to clear the field and hide the results before factoring another number.

Frequently Asked Questions

What is a prime number?

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first few primes are 2, 3, 5, 7, 11, and 13, and 2 is the only even prime because every other even number is divisible by 2.

What is the largest number supported?

This calculator supports positive integers up to 1 trillion (1e12). Because trial division only tests odd candidates up to the square root of the number, even 999,999,999,999 needs at most about 500,000 trial divisions, since its square root is just under 1,000,000.

How is the factor tree built?

The tree shows successive divisions by prime factors until only prime numbers remain at the leaves. At each level the current value is split into its smallest prime factor and the remaining quotient, and the splitting repeats down every branch.

Why is 1 not a prime number?

One has exactly one positive divisor — itself — whereas a prime must have exactly two. Excluding 1 also keeps factorizations unique: if 1 counted as prime you could write 360 = 1 × 2^3 × 3^2 × 5 with any number of extra 1s tacked on, and the fundamental theorem of arithmetic would fail.

What is prime factorization used for?

Its everyday uses are finding greatest common factors and least common multiples and reducing fractions to lowest terms. For example, 360 = 2^3 × 3^2 × 5 and 462 = 2 × 3 × 7 × 11 share one 2 and one 3, so their GCF is 2 × 3 = 6 and their LCM is 2^3 × 3^2 × 5 × 7 × 11 = 27,720 — and indeed 360 × 462 = 166,320 = 6 × 27,720. Factoring also underpins RSA encryption, whose security relies on how hard it is to factor a very large semiprime back into its two primes.

Is this calculator free?

Yes, BestCalc calculators are completely free and run entirely in your browser. No sign-up is required, and the number you enter is never sent to a server.