Prime factorization calculator
Enter any whole number and instantly see its prime factorization — the unique
product of prime numbers that make it up, shown in exponent form like
360 = 2^3 × 3^2 × 5. It is useful for simplifying fractions, finding GCDs and
LCMs, and understanding the building blocks of a number.
How it works
The tool uses trial division, dividing out each prime factor completely before moving on:
start at d = 2
while d × d ≤ remaining:
while remaining is divisible by d: divide it out, count the power
move to the next d
if remaining > 1, it is itself a prime factor
Counting how many times each prime divides gives the exponent form. If nothing smaller than the number divides it, the number is reported as prime.
Worked examples
Example 1 — composite number. Factorizing 360:
- 360 ÷ 2 = 180 ÷ 2 = 90 ÷ 2 = 45 → 2 appears 3 times
- 45 ÷ 3 = 15 ÷ 3 = 5 → 3 appears 2 times
- 5 is prime → 5 appears 1 time
- Result: 360 = 2³ × 3² × 5
Example 2 — perfect square. Factorizing 144: 144 = 2 × 72 = 2 × 2 × 36 = … = 2⁴ × 3². Since both exponents are even, 144 is a perfect square of 12 = 2² × 3.
Example 3 — prime number. Factorizing 97: trial division finds no divisor up to √97 ≈ 9.8, so the output is just 97 (prime).
| Number | Prime factorization | Notes |
|---|---|---|
| 12 | 2² × 3 | 3 distinct factors |
| 97 | 97 | Prime |
| 100 | 2² × 5² | Perfect square |
| 360 | 2³ × 3² × 5 | Highly composite |
| 1,024 | 2¹⁰ | Power of two |
What prime factorization is used for
Fractions. Simplifying 36/48 is easy once you know both as products: 36 = 2² × 3² and 48 = 2⁴ × 3. The GCD is 2² × 3 = 12, so the fraction reduces to 3/4 without guessing.
GCD and LCM. The greatest common divisor of two numbers is the product of the lowest power of each shared prime. The least common multiple uses the highest power of every prime that appears in either factorization. If you factor both numbers first, both calculations become mechanical.
Cryptography. RSA encryption relies on the practical impossibility of factorizing a product of two very large primes. The calculator handles numbers comfortably for classroom and homework use; genuinely large RSA primes are hundreds of digits long and take modern computers an impractically long time to factor.
Number theory. The fundamental theorem of arithmetic guarantees that every whole number greater than 1 has exactly one prime factorization (ignoring order). This uniqueness is what makes prime factorization a reliable tool rather than an approximation.
Edge cases to know
- Entering 1 is not defined because 1 has no prime factors (it is neither prime nor composite).
- Negative numbers can be factorized for the absolute value; the sign is handled separately.
- The algorithm is efficient for numbers up to millions; very large numbers may take a moment for the trial-division loop to complete.
Everything runs locally in your browser, so your numbers never leave your device.