Prime Factorization Calculator
Find all prime factors, a factor tree, all divisors and divisibility rules for any number
What Is Prime Factorization?
Every integer greater than 1 is either prime (divisible only by 1 and itself) or composite (can be written as a product of primes). Prime factorization is the process of writing a number as a product of its prime factors — the "atomic" building blocks of numbers. This is unique for every number (the Fundamental Theorem of Arithmetic).
The Division Method
Divisibility Rules
÷2: Last digit is even. ÷3: Sum of digits divisible by 3. ÷4: Last two digits divisible by 4. ÷5: Ends in 0 or 5. ÷6: Divisible by both 2 and 3. ÷9: Sum of digits divisible by 9. ÷10: Ends in 0. ÷11: Alternating digit sum divisible by 11.
Prime Factorization: Numbers' DNA
Built and verified by Andrius R. · Updated June 2026
Every whole number greater than 1 is either prime or breaks into a product of primes in exactly one way — a result so central it's called the Fundamental Theorem of Arithmetic. That uniqueness is why factoring a number tells you essentially everything about how it behaves in multiplication, division and fractions.
Factoring by hand, the systematic way
Divide by the smallest prime as many times as possible, then move up:
360 ÷ 2 = 180 → ÷ 2 = 90 → ÷ 2 = 45 (2 is exhausted)
45 ÷ 3 = 15 → ÷ 3 = 5 (3 is exhausted)
5 is prime. Result: 360 = 2³ × 3² × 5.
Key efficiency: you only need to test primes up to √n — if nothing up to √360 ≈ 19 divides what's left, the remainder is itself prime. Divisibility shortcuts speed this up: even → divisible by 2; digit sum divisible by 3 → divisible by 3; ends in 0 or 5 → divisible by 5.
What the factorization instantly tells you
- Every divisor. The divisors of 360 are exactly the combinations 2ᵃ3ᵇ5ᶜ with a ≤ 3, b ≤ 2, c ≤ 1 — and counting them is just (3+1)(2+1)(1+1) = 24 divisors, no listing required. (This abundance of divisors is precisely why 360 was chosen for degrees in a circle and why 60 ran Babylonian arithmetic.)
- GCD and LCM by inspection. 360 = 2³·3²·5 and 840 = 2³·3·5·7 share 2³·3·5 → GCD = 120; take highest powers of everything for the LCM. The LCM & GCD calculator visualizes this overlap.
- Whether a fraction terminates. In lowest terms, a fraction gives a terminating decimal exactly when its denominator's primes are only 2s and 5s — the factorization is the whole answer to "why does 1/3 repeat but 1/8 doesn't."
- Perfect squares at a glance: a number is a perfect square exactly when every exponent in its factorization is even. 360's exponents (3, 2, 1) say no; 3,600 = 2⁴·3²·5² says yes.
The asymmetry that protects your bank login
Multiplying two large primes is instant; recovering them from the product is, as far as anyone publicly knows, astronomically hard once the primes are hundreds of digits long. That one-way asymmetry is the engine of RSA encryption, which has secured internet commerce since the 1970s — your browser's padlock ultimately rests on the difficulty of prime factorization. (It's also why mathematicians watch quantum computing closely: a sufficiently large quantum computer running Shor's algorithm would factor efficiently, which is driving today's migration to post-quantum cryptography.)
Prime trivia worth knowing
- 1 is not prime — by definition, and for a good reason: if it were, unique factorization would collapse (360 = 1×1×2³×3²×5 = …).
- 2 is the only even prime, making it the standard first test in any factoring routine.
- Primes never run out — Euclid proved their infinitude around 300 BC with a four-line argument: multiply any finite list of primes, add 1, and the result is divisible by none of them.
- They thin out predictably: near a number n, roughly 1 in every ln(n) numbers is prime — about 1 in 7 around 1,000, 1 in 23 around 10 billion. Sparse, but never gone.
// Fundamental Theorem
Every integer > 1 has exactly one prime factorization (ignoring order). This is the Fundamental Theorem of Arithmetic.
// Count Factors
If n = p^a × q^b × r^c, the total number of factors is (a+1)(b+1)(c+1). Useful for factorization puzzles.
// Perfect Squares
A number is a perfect square if and only if all exponents in its prime factorization are even. e.g. 36 = 2² × 3² ✓
// Largest Prime Factor
After dividing by all small primes, if the remaining quotient > 1, it is itself prime — the largest prime factor.