Prime Factorization Calculator (with Steps)
Prime factors of any whole number up to a trillion, with the division ladder and exponent form.
Inputs
- As a product
- 2 × 2 × 2 × 3 × 3 × 5
- Division ladder
- 360 ÷ 2 = 180; 180 ÷ 2 = 90; 90 ÷ 2 = 45; 45 ÷ 3 = 15; 15 ÷ 3 = 5; 5 ÷ 5 = 1
- Distinct primes
- 2, 3, 5
- Number of divisors
- 24 — from the exponents: (3 + 1) × (2 + 1) × (1 + 1)
Use this calculator on your own site
Free embed
- Two lines of HTML, unlimited views
- Shows a small CalculateEveryday bar, with a credit link under the calculator
What each Prime Factorization input means
- Whole number
- A whole number from 2 to one trillion. A prime comes back as itself; 1 is refused, because it has no prime factors.
Prime Factorization formula
Divide by the smallest prime that goes in exactly, then divide the quotient the same way, until 1 is left; the divisors are the prime factors. Number of divisors = (e₁ + 1)(e₂ + 1)… from the exponents
Every whole number above 1 is either prime or a product of primes in exactly one way — that is the fundamental theorem of arithmetic, and the prime factorization is that product. The ladder method finds it: try 2 and keep dividing while 2 goes in exactly, then 3, then 5, and so on, until the quotient is 1. For 360 that is three 2s, two 3s and one 5, so 360 = 2³ × 3² × 5. Only primes up to the square root need testing, because any larger factor would have a partner below it; if none divides the number, it is prime itself. The exponents also count the divisors: each prime can appear anywhere from 0 to eₖ times in a divisor, so there are (e₁ + 1)(e₂ + 1)… of them — 4 × 3 × 2 = 24 divisors of 360.
Prime Factorization worked example
360: divide by 2 to get 180, by 2 again to get 90, by 2 again to get 45. 2 no longer goes in, so try 3: 45 ÷ 3 = 15, 15 ÷ 3 = 5. Try 5: 5 ÷ 5 = 1, and the ladder ends. The divisors used were 2, 2, 2, 3, 3, 5, so 360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5. From the exponents 3, 2 and 1, the number of divisors is (3 + 1)(2 + 1)(1 + 1) = 24.
More Prime Factorization examples
1,001 = 7 × 11 × 13, which is why multiplying any three-digit number by 1,001 writes it twice: 123 × 1,001 = 123,123. Three different primes each to the first power give (1 + 1)³ = 8 divisors.
2,026 = 2 × 1013. The ladder takes out one 2, then finds no prime up to √1,013 ≈ 31.8 that divides 1,013, so 1,013 is itself prime.
1,024 = 2^10: ten 2s and nothing else. With the single exponent 10, it has 10 + 1 = 11 divisors: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 and 1,024.
Where the Prime Factorization calculator can give the wrong answer
- 1 has no prime factorization — it is neither prime nor composite, and the theorem's uniqueness only works because 1 is left out. The page refuses it rather than showing an empty product.
- Trial division is instant for the numbers allowed here (up to 10¹²) because it only tests primes up to the square root — a million at most. It is not a method for factoring 20-digit numbers; that is what makes RSA encryption hard to break.
- A number whose largest prime factor is close to its square root, such as 999,999,937 × 2, takes the longest, since the ladder has to run all the way up before the last factor falls out.
- Decimals and negatives are not accepted. Prime factorization is defined for whole numbers above 1; −360 factors as −1 × 2³ × 3² × 5 by convention, which is the same factorization with a sign in front.
- A prime input gives a one-line answer: the number itself. The ladder line then says which primes were checked and found not to divide it.
Spotted a mistake? Tell us
Prime Factorization FAQ
- Use the ladder (repeated division) method: divide by 2 as many times as it goes in exactly, then by 3, then 5, 7, 11 and so on, writing each divisor down, until the quotient is 1. The divisors are the prime factors. 84: 84 ÷ 2 = 42, 42 ÷ 2 = 21, 21 ÷ 3 = 7, 7 ÷ 7 = 1, so 84 = 2² × 3 × 7. A factor tree gives the same answer by splitting the number into any two factors and splitting each again until only primes remain.
- 360 = 2³ × 3² × 5. 100 = 2² × 5². 1000 = 2³ × 5³. In general a power of 10 is 2ⁿ × 5ⁿ, which is why 10ⁿ has (n + 1)² divisors: 1000 has 16.
- Test whether any prime up to its square root divides it. For 97 the square root is under 10, so only 2, 3, 5 and 7 need checking; none divides 97, so it is prime. The page reports a prime input as prime and shows the limit it checked up to.
- Finding the greatest common divisor and least common multiple of two numbers (take the shared primes, or every prime at its highest power), simplifying fractions and square roots, counting a number's divisors, and, at a much larger scale, the mathematics behind public-key cryptography, which depends on factoring being slow for very large numbers.