A prime factorization calculator writes a whole number as a product of prime numbers. For example, 840 = 2 × 2 × 2 × 3 × 5 × 7, or 2³ × 3 × 5 × 7.
On this page

How to use the prime factorization calculator
- Enter a whole number of 2 or more.
- Read the prime factors, smallest first.
How the prime factorization calculator works
The prime factorization calculator uses trial division. Starting at 2, it divides the number by each candidate p as many times as it divides evenly, then moves to the next p. After 2 and 3 it only tries numbers of the form 6k ± 1, which skips most composites, and it stops when p × p is larger than what remains. Any remainder above 1 at that point must itself be prime, so it is added to the list. The result is shown as a product, smallest factor first, for example 840 = 2 × 2 × 2 × 3 × 5 × 7.
Enter a whole number of 2 or more, up to 9,007,199,254,740,991. Decimals are rejected rather than cut off. The result also shows the exponent form and says whether the number is prime.
Prime factorization calculator worked example
Take 840. It is even, so divide by 2: 420, 210, 105. 105 is odd, so try 3: 35. 35 is not divisible by 3, so try 5: 7. Now 5 × 5 is more than 7, so the loop stops and 7 is added. The prime factorization calculator returns 2 × 2 × 2 × 3 × 5 × 7, which in exponent form is 2³ × 3 × 5 × 7. Multiply back to check: 8 × 3 × 5 × 7 = 840.
| Number | Prime factors | Exponent form |
|---|---|---|
| 840 | 2 × 2 × 2 × 3 × 5 × 7 | 2³ × 3 × 5 × 7 |
| 360 | 2 × 2 × 2 × 3 × 3 × 5 | 2³ × 3² × 5 |
| 1001 | 7 × 11 × 13 | 7 × 11 × 13 |
| 2026 | 2 × 1013 | 2 × 1013 |
| 999999 | 3 × 3 × 3 × 7 × 11 × 13 × 37 | 3³ × 7 × 11 × 13 × 37 |
| 97 | 97 | prime |
Why every number has one answer
The fundamental theorem of arithmetic says every whole number above 1 is either prime or a product of primes in exactly one way, apart from the order. That is why a factor tree for 360 always ends with three 2s, two 3s and one 5, whichever split you start with. A number with only itself as a factor, such as 97 or 1013, is prime.
Uses of prime factors
Prime factors make other tasks easier. The greatest common factor of two numbers is the product of the primes they share, using the lower power: 840 and 360 share 2³ × 3 × 5 = 120. The least common multiple uses the higher power of every prime: 2³ × 3² × 5 × 7 = 2,520. Prime factors also simplify fractions and square roots, since √360 = √(2² × 3² × 10) = 6√10, and they count divisors: 840 has (3 + 1)(1 + 1)(1 + 1)(1 + 1) = 32 divisors.
Limits for very large numbers
Trial division is fast for everyday numbers. A seven-digit number factors almost instantly. The tool reads your input as an exact integer and accepts numbers up to 9,007,199,254,740,991 (2⁵³ − 1, about 9 × 10¹⁵), the largest whole number a browser can handle exactly; larger inputs are rejected instead of being rounded. At that limit a number with a large prime factor needs about 30 million divisions, which takes a moment. For example 2⁵³ − 1 itself is 6361 × 69431 × 20394401. The difficulty of factoring very large numbers is the reason some encryption, such as RSA, is secure.
Quick divisibility checks
- 2: the last digit is even.
- 3: the digit sum is divisible by 3 (999,999 has a digit sum of 54).
- 5: the last digit is 0 or 5.
- 11: the alternating digit sum is divisible by 11 (1,001 gives 1 − 0 + 0 − 1 = 0).
These rules let you predict the first few factors before using the prime factorization calculator.
Writing the answer with exponents
Teachers often ask for exponent form. Count how many times each prime appears and write it as a power. 999,999 has three 3s, so it becomes 3³ × 7 × 11 × 13 × 37.
Tips
- Group repeated factors into powers for neat answers.
- Multiply the factors back to check your work.
- Use the prime factorization calculator for GCF and LCM homework steps.
Related converters and calculators
Related calculators:
- Factor calculator: all factors
- GCF calculator: greatest common factor
- LCM calculator: least common multiple
- Common factor calculator: shared factors
Sources
OpenStax Prealgebra 2e, 2.5: Prime factorization and the least common multiple.
Formula and method
Trial divide by 2, 3, then 6k+/-1 while p*p <= n (BigInt); if remainder > 1 append it.
Standard trial-division prime factorization. Headline joins factors with multiplication signs.
Questions about this calculator
What is the prime factorization of 840?
2 × 2 × 2 × 3 × 5 × 7.
Is 1 prime?
No. Enter 2 or more.
How does it work?
Trial division by 2, 3 and then 6k ± 1 up to the square root of what remains.
What is the largest number it accepts?
9,007,199,254,740,991 (2^53 − 1); larger inputs are rejected.
Is 97 prime?
Yes.
Check the assumptions and units before relying on a result. Financial, tax and health estimates do not replace advice for your individual circumstances.
Report a calculation issue