CalcKit CalcKit
My Calculators
Sign in Sign up

Prime Factorization Calculator

Find the prime factorization of any whole number up to 24 digits, with exponents, check if it is prime, and see its divisors and the nearest primes.

Prime?
–
Prime factorization
–
Divisors
–
Previous prime
–
Next prime
–

Prime Factorization Calculator: A Quick Guide

Type any whole number up to 24 digits and the calculator tells you at once whether it is prime, writes its prime factorization with exponents, lists its divisors, and finds the nearest primes below and above it. Everything is worked out in your browser, as you type.

What is prime factorization?

A prime number is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13 and so on. Every other whole number greater than 1 is composite, and can be written as a product of primes in exactly one way, apart from their order. That product is its prime factorization:

  • 12 = 2² × 3
  • 360 = 2³ × 3² × 5
  • 1001 = 7 × 11 × 13

The small raised numbers are exponents: 2³ means the prime 2 appears three times, 2 × 2 × 2.

How to use the calculator

  1. Type a number into the Number field.
  2. Read the results below it: whether the number is prime, its factorization, its divisors and the nearest primes. They change as you type.
  3. Copy the factorization with the copy button. It is copied with ^ for the exponents, 2^3 × 3^2 × 5, so it pastes cleanly anywhere.

Reading the results

  • Prime? says Prime, Not prime (composite), or, for 0 and 1, Neither prime nor composite.
  • Prime factorization is the number as a product of primes. A prime is its own factorization.
  • Divisors gives how many whole numbers divide the number exactly, and lists them when there are 200 or fewer. The count comes straight from the exponents: for 2³ × 3² × 5 it is (3 + 1) × (2 + 1) × (1 + 1) = 24.
  • Previous prime and next prime are the closest primes below and above the number. There is no prime below 2.

How to find a prime factorization by hand

Divide by the smallest prime that goes in exactly, and repeat with what is left, until what is left is 1. For 360:

  1. 360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45: three 2s.
  2. 45 ÷ 3 = 15, 15 ÷ 3 = 5: two 3s.
  3. 5 ÷ 5 = 1: one 5.

So 360 = 2³ × 3² × 5. A factor tree gives the same answer: split the number into any two factors, then split those, until every branch ends in a prime. To test whether a number is prime by hand, you only need to try dividing by the primes up to its square root.

How the calculator does it

By hand, or with simple trial division, a 20-digit number would take far too long. The calculator uses the same methods as mathematics software: the Miller–Rabin test to tell whether a number is prime, which is exact for every number below 3.3 × 10²⁴ with the bases it uses, and Pollard's rho method to split a large composite number into its factors. Both run in a fraction of a second, even for a product of two 12-digit primes.

Frequently asked questions

Is 1 a prime number?

No. A prime has exactly two divisors, 1 and itself, and 1 has only one. Leaving 1 out is what makes every number's prime factorization unique. 0 is not prime either.

Is 2 a prime number?

Yes, and it is the only even prime: every other even number can be divided by 2.

What is the prime factorization of a prime number?

The number itself: the prime factorization of 97 is just 97.

How do you find the greatest common factor or least common multiple with prime factors?

Factor both numbers. The greatest common factor takes each prime they share with its smaller exponent; the least common multiple takes every prime with its larger exponent. For 12 = 2² × 3 and 18 = 2 × 3²: the greatest common factor is 2 × 3 = 6 and the least common multiple is 2² × 3² = 36.