↑↓ to move ↵ to open Esc to close Browse all tools

Prime Factorization Calculator

Type a whole number to get its prime factorization with exponents, a factor tree, the division steps, every divisor and whether the number is prime.

Your number

Up to 24 digits. Commas and spaces between digit groups are fine.
Prime factorization of 360

Try an example
Is it prime?
Prime factors with repeats
Number of divisors
Sum of divisors
Previous prime
Next prime

Factor tree

Split off the smallest prime at each step. The primes, the leaves of the tree, are highlighted.

Step by step: divide by primes

    All divisors

    Runs on your device. Nothing you enter is sent to a server.

    Prime Factorization Calculator by Freebiefy, free online tools

    Embed this tool on your site

    Paste this code into your page. The tool runs in the visitor's browser, free and without signup. The height adjusts to the content.

    What prime factorization means

    A prime number is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11 and so on. Every other whole number greater than 1 is composite, which means it can be split into smaller factors. Keep splitting, and you always end up with primes. The list of primes you end up with is the prime factorization of the number.

    For 360 that list is 2, 2, 2, 3, 3 and 5, so 360 = 2 × 2 × 2 × 3 × 3 × 5. Exponents make it shorter: 360 = 2³ × 3² × 5. No matter how you split the number along the way, you always get the same primes the same number of times. That fact is called the fundamental theorem of arithmetic, and it is why the prime factorization works like a fingerprint of a number.

    Method 1: divide by the smallest prime

    The quickest way by hand is to divide by primes from small to large. Start with 2 and divide as long as the result is even. Then try 3, then 5, then 7, and so on. Each time a prime goes in, write it down and continue with the quotient. Stop when the quotient is 1.

    1. 360 ÷ 2 = 180
    2. 180 ÷ 2 = 90
    3. 90 ÷ 2 = 45, which is odd, so 2 is done
    4. 45 ÷ 3 = 15
    5. 15 ÷ 3 = 5
    6. 5 ÷ 5 = 1

    The primes you divided by are the prime factors: 2³ × 3² × 5. Written in a column with the quotients next to them, this is often called a division ladder. You only need to test primes up to the square root of what is left. Once the next prime squared is larger than the remaining number, that number is itself prime.

    Method 2: the factor tree

    A factor tree starts with the number at the top. Split it into any two factors, draw a branch to each, and keep splitting every factor that is not prime. The primes at the ends of the branches are the prime factorization. You can start 360 as 36 × 10 or as 2 × 180, and the tree will look different, but the leaves are always three 2s, two 3s and one 5. The calculator always splits off the smallest prime, so its tree matches the division steps line by line.

    Is it prime?

    A number is prime when its factorization has exactly one factor: the number itself. The calculator says so and also shows the nearest primes below and above, which is handy when you need a prime close to some size. A few facts that help with quick checks:

    • 2 is the only even prime. Every other even number has 2 as a factor.
    • A number is divisible by 3 when its digit sum is, so 1,001 (digit sum 2) is not, while 111 (digit sum 3) is.
    • 0 and 1 are neither prime nor composite. 0 is divisible by every whole number and has no prime factorization, and 1 has no prime factors at all.

    There is no largest prime. Euclid already proved that the primes go on forever, in Book IX, Proposition 20 of the Elements. Here are the 25 primes below 100:

    2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

    Counting divisors with the exponents

    The prime factorization tells you every divisor of a number without testing them one by one. A divisor of 360 = 2³ × 3² × 5 can use 2 zero to three times, 3 zero to two times and 5 zero or one time. That gives (3 + 1) × (2 + 1) × (1 + 1) = 24 divisors. The sum of all divisors follows from the same idea: (1 + 2 + 4 + 8) × (1 + 3 + 9) × (1 + 5) = 15 × 13 × 6 = 1,170.

    When the divisors other than the number itself add up to exactly the number, it is called a perfect number. 8128 is one: its divisors sum to 16,256, which is twice 8,128. Try it with the example above.

    What prime factors are good for

    Prime factors make many school problems easier. The greatest common factor of two numbers uses the primes both share, and the least common multiple uses every prime at its highest power, which the LCM and GCF calculator shows in a table. To simplify a fraction like 84/360, cancel the primes that the top and bottom share, or let the fraction calculator do it. And to simplify a square root, pull out every prime that appears twice: √360 = √(2² × 3² × 2 × 5) = 6√10.

    How the calculator handles big numbers

    For small numbers the calculator divides by primes, just like you would by hand. For large numbers that alone would take far too long, so it uses two standard methods from number theory. The Miller-Rabin test checks whether a number is prime without factoring it. With the first 13 primes, 2 to 41, as test bases, the test gives the right answer for every number below 3,317,044,064,679,887,385,961,981, according to OEIS sequence A014233. The 24-digit limit keeps every input inside that range, so a number marked prime is proven prime, not just probably prime. To split large composite numbers, it uses Pollard's rho method, which finds large factors far faster than trying divisors one by one.

    Everything runs in your browser. Big numbers are factored in a background thread, so the page keeps responding, and the Stop button ends a long search right away.

    How to use the prime factorization calculator

    1. 1Type a whole number with up to 24 digits. The result updates as you type.
    2. 2Read the prime factorization with exponents at the top, and below it whether the number is prime, how many divisors it has and the nearest primes.
    3. 3Follow the factor tree and the division steps, scroll through all divisors, then copy the result or a link that opens the calculator with your number.

    Frequently asked questions

    Is 1 a prime number?

    No. A prime number has exactly two divisors, 1 and itself, and 1 has only one divisor. Leaving 1 out also keeps prime factorizations unique: if 1 counted as a prime, you could write 6 as 2 × 3, 1 × 2 × 3, 1 × 1 × 2 × 3 and so on. So 1 is neither prime nor composite, and it has no prime factors.

    What is the difference between factors and prime factors?

    The factors (or divisors) of a number are all the whole numbers that divide it evenly. 12 has six: 1, 2, 3, 4, 6 and 12. The prime factors are only the primes among them, 2 and 3, and the prime factorization says how often each one goes in: 12 = 2² × 3.

    How do I check if a number is prime by hand?

    Try dividing it by every prime up to its square root. If none of them divides evenly, the number is prime. For 97 the square root is just under 10, so you only test 2, 3, 5 and 7. None of them works, so 97 is prime. You never need to go past the square root, because a factor above it would pair with one below it.

    How many divisors does a number have?

    Write the prime factorization, add 1 to each exponent and multiply. 360 = 2³ × 3² × 5, so it has (3 + 1) × (2 + 1) × (1 + 1) = 24 divisors. Each divisor picks an exponent from 0 to 3 for the 2, from 0 to 2 for the 3 and 0 or 1 for the 5.

    How large a number can the calculator factor?

    Any whole number with up to 24 digits, so up to 999,999,999,999,999,999,999,999. Most numbers take a fraction of a second. The slowest case is a number made of two primes of about 12 digits each, which can take several seconds. The calculation runs in the background, and you can stop it at any time.

    Can I factor a negative number?

    A negative number is −1 times a positive number, so the calculator factors the positive part and writes −1 in front: −360 = −1 × 2³ × 3² × 5. Primes themselves are always positive, so a negative number is never called prime.