Enter any positive integer into the calculator above, and it will break that number down into its product of prime factors. You get the full factorization instantly, displayed in both expanded and exponent form.
Prime factorization is the process of finding which prime numbers multiply together to produce a given integer. Every whole number greater than 1 has exactly one unique prime factorization. This calculator handles the math so you can focus on using the result.
Whether you need to simplify fractions, find the greatest common divisor, compute the least common multiple, or work through a number theory homework problem, this free prime factorization calculator gives you the building blocks.
Find the prime factorization of any number
Type your number into the input field and press calculate. The tool returns every prime factor along with how many times each appears.
For example, entering 360 returns 2 × 2 × 2 × 3 × 3 × 5. That is the complete factorization. The calculator also shows the exponent form: 2³ × 3² × 5.
You can use the result to:
- Simplify or compare fractions
- Find the greatest common factor of two or more numbers
- Compute the least common multiple
- Check whether a number is prime
- Explore patterns in number theory or math worksheets
If the calculator returns just the number itself, that number is prime. It has no smaller prime factors.
What is a prime number?
A prime number is a natural number greater than 1 that has exactly two divisors: 1 and itself. It cannot be divided evenly by any other whole number.
The first several prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29. The list continues infinitely. There is no largest prime.
A few points that often cause confusion:
- Is 0 a prime number? No. Zero is divisible by every nonzero integer, so it does not meet the definition.
- Is 1 a prime number? No. By convention and by the requirements of the fundamental theorem of arithmetic, 1 is neither prime nor composite. It is a special case called a unit.
- Is 2 special? Yes. It is the only even prime number. Every other even number is divisible by 2, making it composite.
Prime numbers cannot be broken into smaller whole number factors. That property is exactly what makes them the building blocks of all other integers.
Prime factor vs. composite number
A prime factor is any prime number that divides evenly into a larger number. A composite number is any integer greater than 1 that is not prime, meaning it has at least one divisor besides 1 and itself.
Every composite number can be written as a product of prime factors. That decomposition is unique (ignoring the order of the factors). This is why primes matter: they are the atoms of multiplication.
| Type | Definition | Examples |
|---|---|---|
| Prime | Exactly two divisors (1 and itself) | 2, 3, 7, 41 |
| Composite | More than two divisors | 4, 12, 100, 360 |
| Neither | The number 1 | 1 |
How a composite number is built from prime factors
Take 84 as an example. You can express it as 2 × 2 × 3 × 7. Each of those factors is prime, and multiplying them back together produces 84.
No matter how you start splitting 84 into smaller factors, you always arrive at the same set of primes. You might first split it as 4 × 21, then break 4 into 2 × 2 and 21 into 3 × 7. Or you might start with 2 × 42, then keep going. The endpoint is identical: 2² × 3 × 7.
This uniqueness is guaranteed by the fundamental theorem of arithmetic, covered in a later section.
How to find the prime factorization using a factor tree
A factor tree is a visual method for finding the prime factorization of any composite number. You start with the original number at the top, split it into two factors, and keep splitting until every branch ends at a prime.
Steps:
- Write the number you want to factor.
- Find any two whole numbers (other than 1 and the number itself) that multiply to give that number.
- Write them as branches below.
- If a branch is prime, circle it and stop. If it is composite, repeat step 2.
- When every branch ends at a circled prime, collect all the primes. Their product is the prime factorization.
Factor tree for integer factorization
Here is a factor tree for 180:
<code> 180 / \ 12 15 / \ / \ 4 3 3 5 / \ 2 2 </code>
The primes at the ends: 2, 2, 3, 3, 5. So 180 = 2² × 3² × 5.
You could also start by splitting 180 into 2 × 90, then 90 into 2 × 45, and so on. The use of a factor tree is flexible. Every valid tree for the same number produces the same set of prime factors.
Factor trees work well for numbers you can manage by hand. For large numbers, the trial division algorithm (below) or this calculator is faster.
Product of prime factors and product of prime factors in exponent form
The product of prime factors is the full multiplication expression. For 360, that is 2 × 2 × 2 × 3 × 3 × 5.
The product of prime factors in exponent form groups repeated primes using exponents. The same number becomes 2³ × 3² × 5. This compact notation is standard in textbooks, math worksheets, and most calculators.
Both forms carry the same information. The exponent form is easier to read, especially for large numbers with many repeated factors. It also simplifies further calculations like finding the greatest common divisor or least common multiple.
This calculator displays both forms so you can copy whichever you need.
Prime factorizations and division
Division is the core operation behind finding prime factorizations by hand. You repeatedly divide the number by primes until the quotient reaches 1.
Start with the smallest prime, 2. If the number is divisible by 2, divide and record 2 as a factor. Keep dividing by 2 until it no longer divides evenly. Then move to 3, then 5, and continue through larger primes.
Trial division algorithm for prime factorizations
Trial division is the most straightforward algorithm for prime factorization. Here is how it works step by step:
- Set the number to factor as N.
- Start with the smallest prime, p = 2.
- While p × p ≤ N:If N ÷ p has no remainder, record p as a factor and replace N with N ÷ p. Otherwise, increase p to the next prime (or simply the next integer; composite trial divisors will never divide in because their prime components were already removed).
- If N is still greater than 1 after the loop, N itself is prime. Record it as the final factor.
Example: 252
- 252 ÷ 2 = 126 → factor: 2
- 126 ÷ 2 = 63 → factor: 2
- 63 ÷ 2 → not divisible, move to 3
- 63 ÷ 3 = 21 → factor: 3
- 21 ÷ 3 = 7 → factor: 3
- 7 ÷ 3 → not divisible, move to 5
- 7 ÷ 5 → not divisible, move to 7
- 7 × 7 = 49 > 7, so stop. Record 7.
Result: 252 = 2² × 3² × 7.
Using trial division, you only need to test each integer up to the square root of N. That is a significant shortcut.
Find the prime factorization of large numbers
Trial division works perfectly for numbers up to several million. Beyond that, the process slows down because the number of primes to test grows.
For very large numbers, mathematicians and computer scientists use faster algorithms:
- Pollard's rho algorithm: a probabilistic method that finds nontrivial factors efficiently for numbers with small factors.
- Quadratic sieve: effective for numbers up to roughly 100 digits.
- General number field sieve: the fastest known method for the largest numbers, used in cryptography research.
This calculator uses optimized trial division, which handles everyday math problems and classroom assignments with ease. For numbers in the billions or beyond, specialized software may be needed.
Greatest common divisor from prime factorizations
Once you have the prime factorization of two or more numbers, finding the greatest common divisor (GCD) is simple.
- Write the prime factorization of each number.
- Identify the primes they share.
- For each shared prime, take the smaller exponent.
- Multiply those together.
Example: Find the GCD of 360 and 252.
- 360 = 2³ × 3² × 5
- 252 = 2² × 3² × 7
Shared primes: 2 (smaller exponent: 2) and 3 (smaller exponent: 2).
GCD = 2² × 3² = 4 × 9 = 36.
The same factorizations let you compute the least common multiple by taking the larger exponent for every prime that appears in either number.
Math behind the prime factorization calculator
This section covers the theoretical foundation that makes the calculator's output reliable and unique.
The fundamental theorem of integer factorization
The fundamental theorem of arithmetic (also called the unique factorization theorem) states:
Every integer greater than 1 can be expressed as a product of prime numbers in exactly one way, up to the order of the factors.
This theorem guarantees two things:
- Existence: a prime factorization always exists for any integer greater than 1.
- Uniqueness: there is only one set of prime factors (with their multiplicities) for each number.
Without this theorem, prime factorization would be ambiguous. Because of it, you can trust that the output of any correct algorithm is the one and only answer.
Natural numbers, divisors, and multiplication
Natural numbers (1, 2, 3, 4, ...) are the counting numbers. A divisor of a natural number N is any natural number that divides N with no remainder.
Multiplication ties everything together. If you know the complete list of prime divisors of N and how many times each divides in, you can reconstruct N by multiplying them. Conversely, starting from N, repeated division extracts those primes one by one.
This relationship between multiplication and division is the mechanical basis for every factorization algorithm, from simple factor trees to advanced sieves.
Prime factorization calculator for math calculators and multiple uses
This calculator fits alongside other math calculators you might use for arithmetic, fractions, or number theory. Here are some practical applications of prime factorization:
- Simplifying fractions: divide numerator and denominator by their GCD, which you find from their shared prime factors.
- Adding fractions with unlike denominators: compute the least common multiple of the denominators using prime factorizations.
- Cryptography foundations: RSA encryption relies on the difficulty of factoring the product of two very large primes.
- Divisibility checks: the factorization tells you every number that divides evenly into your original value.
- Classroom and 6th grade math: factor trees and prime decomposition are standard topics. This tool lets students check their work.
If you want to find the prime factorization quickly and move on with your calculation, the tool at the top of this page does exactly that. Enter your number, read the result, and apply it wherever you need it.
When this calculator gives an estimate
For standard integers within the calculator's supported range, the output is exact. Prime factorization is a deterministic mathematical process, not a statistical estimate.
However, keep these practical limits in mind:
- Very large numbers (hundreds of digits or more) may exceed the processing capability of a browser-based tool. For those, dedicated software or command-line programs are more appropriate.
- Input errors (decimals, negative numbers, or non-numeric characters) will not produce valid factorizations. Prime factorization applies only to positive integers greater than 1.
- Floating-point quirks: if you paste a number that exceeds JavaScript's safe integer limit (9,007,199,254,740,991), rounding may occur before factorization begins. For numbers near or above that threshold, verify with a specialized tool.
This calculator is a planning and learning aid. For research-grade factorization of extremely large numbers, consult dedicated number theory software.