Prime Factorization Calculator: Factor Tree & Steps

Type any whole number up to 24 digits long to break it into primes. You get the answer in exponent form, a factor tree, the division ladder, every factor pair, and facts such as the number of factors. If the number is prime, the calculator says so and shows why.

Prime Factorization Calculator
Prime factorization–
Factor tree
Division ladder
All factors
Step by step

    Reading the Result

    For 360, the calculator gives 360 = 2³ × 3² × 5. The raised numbers are exponents that count how often each prime appears, so in full it’s 2 × 2 × 2 × 3 × 3 × 5.

    Every whole number above 1 is either prime, with exactly two factors (1 and itself), or composite. The badge next to the answer says which. All 25 prime numbers from 1 to 100 are listed in one chart.

    By Hand: Divide by the Smallest Prime, and Know When to Stop

    Divide by the smallest prime that goes in evenly, and keep going until 1 is left:

    • 360 ÷ 2 = 180, ÷ 2 = 90, ÷ 2 = 45 (2 three times)
    • 45 ÷ 3 = 15, ÷ 3 = 5 (3 twice)
    • 5 ÷ 5 = 1

    The step that saves the most time is knowing when to stop. You only need to try primes up to the square root of what’s left. If a number had two factors both bigger than its square root, their product would be bigger than the number itself, which is impossible. So:

    • To test 97, try 2, 3, 5 and 7, since √97 ≈ 9.85. None of them divides 97, so it’s prime. There’s no need to check 11, 13 or anything higher.
    • For 1001, √1001 ≈ 31.6. Trying primes in order, 7 works: 1001 = 7 × 143. Then 143 = 11 × 13, so 1001 = 7 × 11 × 13.

    The stopping rule matters even more for big numbers. Some guides only say to keep testing in turn, with no point to stop. To prove that a 12-digit prime near a trillion is prime, the square-root rule needs only the 78,498 primes below one million. Without it, you’d be trying about 37.6 billion primes.

    Quick Divisibility Checks

    These rules tell you whether a prime divides a number without doing the division:

    PrimeRuleExample
    2Last digit is even360 ends in 0 ✓
    3Digit sum divides by 3123,456,789: digits add to 45 ✓
    5Last digit is 0 or 545 ✓
    7Double the last digit and subtract it from the rest. Repeat if needed1001: 100 − 2 = 98 = 7 × 14 ✓
    11Alternating digit sum is 0 or divides by 111001: 1 − 0 + 0 − 1 = 0 ✓

    The digit sum 45 also divides by 9, which is why 123,456,789 = 3² × 3,607 × 3,803.

    Numbers That Look Prime but Aren’t

    Odd numbers that don’t end in 5 are easy to mistake for primes:

    NumberFactorsCaught by
    513 × 17digit sum 6
    573 × 19digit sum 12
    873 × 29digit sum 15
    917 × 13the 7 rule: 9 − 2 = 7
    1197 × 17the 7 rule: 11 − 18 = −7
    14311 × 13the 11 rule: 1 − 4 + 3 = 0
    22113 × 17trial division up to √221 ≈ 14.9

    221 is the trickiest, since 13 and 17 have no handy rule, but the square-root limit means only six primes to try.

    Factor Trees: Different Shapes, Same Primes

    A factor tree splits a number into any two factors, then keeps splitting until only primes are left. 360 can open as 18 × 20 or as 2 × 180. The trees look different, but the ends of the branches are always 2, 2, 2, 3, 3 and 5. The calculator starts with the factor pair closest to the square root, which keeps the tree short.

    The primes always come out the same because of the fundamental theorem of arithmetic: every whole number above 1 has exactly one prime factorization, apart from the order of the factors. This is also why 1 isn’t counted as a prime. If it were, 6 could be written as 2 × 3, 1 × 2 × 3, 1 × 1 × 2 × 3 and so on, and factorizations would no longer be unique.

    What the Factorization Tells You

    • Number of factors. Add 1 to each exponent and multiply. For 2³ × 3² × 5, that’s (3 + 1)(2 + 1)(1 + 1) = 24 factors.
    • Perfect squares and cubes. A number is a perfect square when every exponent is even, and a perfect cube when every exponent divides by 3. 1,024 = 2¹⁰ is a square (32²) but not a cube.
    • Simplifying square roots. Pair up equal primes and move each pair outside the root. √360 = √(2² × 3² × 2 × 5) = 2 × 3 × √10 = 6√10. The Square Root Calculator does this for any number.
    • GCF and LCM. Compare the factorizations of two numbers. The GCF uses each shared prime at its lowest power, and the LCM uses every prime at its highest power. The LCM & GCF Calculator lays this out in a table.

    0, 1 and Negative Numbers

    • 0 has no prime factorization. Every prime divides 0, so no single list of primes describes it.
    • 1 has no prime factors at all. It is neither prime nor composite.
    • Negative numbers are written as −1 times the factorization of the positive number: −72 = −1 × 2³ × 3².

    Decimals and fractions have no prime factorization, so the calculator asks for a whole number.

    Big Numbers

    The calculator factors numbers up to 24 digits in your browser, usually in under a second. For example:

    • 600,851,475,143 = 71 × 839 × 1,471 × 6,857
    • 18,446,744,073,709,551,617 (that’s 2⁶⁴ + 1) = 274,177 × 67,280,421,310,721

    The hard case is two large primes of similar size, because nothing small divides the number. For those, the calculator uses Pollard’s rho method instead of trial division. RSA encryption relies on this difficulty: its keys are products of primes hundreds of digits long, far beyond what any known method can factor in practical time.