Prime Factorization Calculator
Factor any whole number up to 40 digits into primes, with a factor tree, exponent form, every divisor and a prime check. Runs privately in your browser.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the Prime Factorization Calculator?
Type a whole number and see it broken into prime factors, written both in full (2 × 2 × 2 × 3 × 3 × 5) and in exponent form (2³ × 3² × 5). A factor tree shows the splits, and the page also answers the related questions: is the number prime, how many divisors does it have, what do they add up to, and what are they.
Small numbers factor instantly. Large ones, up to 40 digits, are handled with the same methods mathematicians and computer algebra systems use: trial division by small primes, Pollard's rho algorithm to find big factors, and the Miller–Rabin test to confirm that each factor really is prime.
If a number is the product of two very large primes, it may not split within the time the page allows. The calculator then says so plainly and shows which part is composite, rather than claiming it is prime or freezing your browser.
- Factors numbers up to 40 digits with BigInt
- Trial division, Pollard's rho and Miller–Rabin
- Factor tree, expanded and exponent forms
- Prime check, divisor count, divisor sum and all divisors
- Honest reporting when a large composite cannot be split
How to use the Prime Factorization Calculator
- Type a whole number of 2 or more. Commas and spaces are ignored.
- Read the factorization in exponent form at the top, with the expanded product below it.
- Check the "Is it prime?" card, the divisor count and the divisor sum.
- Look at the factor tree to see how the number splits, smallest prime first.
- Scroll to the full list of divisors and factor pairs, then copy or share.
Worked examples
A textbook number
Input
360
Output
2³ × 3² × 5; 24 divisors; sum 1,170
360 halves three times to 45, which is 3 × 3 × 5. The exponents 3, 2 and 1 give (4)(3)(2) = 24 divisors.
This year
Input
2026
Output
2 × 1013
1013 is prime, so 2026 has only four divisors: 1, 2, 1013 and 2026.
A famous puzzle
Input
600851475143
Output
71 × 839 × 1471 × 6857
This is Project Euler problem 3. Trial division finds all four primes in a fraction of a second.
A big one
Input
18446744073709551615 (2^64 − 1)
Output
3 × 5 × 17 × 257 × 641 × 65537 × 6700417
The largest unsigned 64-bit integer factors into seven primes, including the Fermat primes 3, 5, 17, 257 and 65537.
Background and insight
The fundamental theorem of arithmetic says every whole number greater than 1 can be written as a product of primes in exactly one way, apart from the order. That is why any factor tree for 360 ends with the same leaves, three 2s, two 3s and a 5, however you split it.
Once you have the factorization, other facts follow from the exponents. A number p^a × q^b × r^c has (a + 1)(b + 1)(c + 1) divisors, so 360 = 2³ × 3² × 5 has 4 × 3 × 2 = 24. The sum of divisors multiplies (p^(a+1) − 1)/(p − 1) for each prime, which is how perfect numbers such as 28 = 1 + 2 + 4 + 7 + 14 are recognised.
For primality, the calculator uses Miller–Rabin with the first 13 primes as bases, which Sorenson and Webster proved has no false positives below about 3.3 × 10^24. Above that, it tests 25 bases, which is a strong probable-prime result rather than a formal proof, and the page labels it that way. Factoring huge semiprimes is hard on purpose: the security of RSA encryption depends on it.
Common use cases
Homework on factor trees
Check a factor tree, the exponent form and the divisor count for numbers in a worksheet.
Simplifying fractions and roots
Factor the numerator and denominator to cancel, or pull square factors out of a root: √72 = √(2³ × 3²) = 6√2.
Programming and puzzles
Test whether a number is prime, find divisors for a loop, or check a Project Euler answer.
Cryptography lessons
See for yourself how easily small semiprimes split and how hard large ones become, which is the idea behind RSA.
Tips and limitations
- 1 is neither prime nor composite and has no prime factors. 2 is the only even prime.
- To test a number by hand, you only need to try primes up to its square root. If none divides it, it is prime.
- A quick check for 3 or 9: add the digits. 2026 has digit sum 10, so 3 does not divide it.
- Numbers with many divisors (like 360, 720 and 5,040) were favoured for measures and time because they split evenly in many ways.
- If you see a bracketed composite, its two prime factors are each probably more than 12 digits long. Specialist software such as a number field sieve is needed for those.
Frequently asked questions
What is prime factorization?
It is writing a whole number as a product of prime numbers. 84 = 2 × 2 × 3 × 7, or 2² × 3 × 7 in exponent form. Every number above 1 has exactly one prime factorization.
How do you make a factor tree?
Split the number into any two factors, then keep splitting each branch until every end is prime. Circle the primes. For 60: 60 = 2 × 30, 30 = 2 × 15, 15 = 3 × 5, so 60 = 2² × 3 × 5.
How can I tell if a large number is prime?
For big numbers, trying every divisor is too slow, so mathematicians use the Miller–Rabin test. This calculator runs it with bases that are proven exact below 3.3 × 10^24 and labels larger results as strong probable primes.
How many divisors does a number have?
Add 1 to each exponent in the prime factorization and multiply. 360 = 2³ × 3² × 5¹ has (3 + 1)(2 + 1)(1 + 1) = 24 divisors. A prime always has exactly 2.
Is 1 a prime number?
No. A prime has exactly two different divisors, 1 and itself, and 1 has only one. Excluding 1 is also what keeps prime factorizations unique.
Why can some big numbers not be factored here?
If a number is the product of two primes that are each more than about 12 digits long, Pollard's rho needs too many steps for a web page. The calculator stops after a time budget and marks that part as composite. This difficulty is what RSA encryption relies on.
Is there an in-depth guide to the Prime Factorization Calculator?
Yes. “Percentages, Fractions and Ratios: How the Arithmetic Fits Together” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.