Prime Factorization Calculator
Type a whole number and read its prime factorization three ways at once: the exponent form to write down, the same factors written out as a plain product to check it against, and a factor tree showing which prime came out at each step. The divisor count sits beside them, because it falls straight out of the exponents and it is the next thing most people are asked for. Everything is worked in exact integer arithmetic rather than in floating point, so numbers past the point where an ordinary calculator starts rounding still come back right, and the factors always multiply back to the number you typed. Above ten thousand million million the tool says the number is too large instead of hanging, which is the honest answer for trial division at that size.
1,386 = 2 × 3^2 × 7 × 11, written out 2 × 3 × 3 × 7 × 11. It has 24 divisors, from (1 + 1) × (2 + 1) × (1 + 1) × (1 + 1) = 24.
Whole numbers above 1, up to ten thousand million million. Thousands may be grouped in threes, as 1,386.
Common questions
- What is prime factorization?
- It is writing a whole number as a product of primes, the numbers above 1 that nothing but 1 and themselves divide. 1,386 comes apart as 2 × 3 × 3 × 7 × 11, which is written 2 × 3^2 × 7 × 11 once the repeats are collected. Every whole number above 1 has exactly one such factorization, give or take the order you write it in, which is why there is a single right answer here and not a matter of opinion. That uniqueness is what makes the factorization useful: two numbers share a factor only if they share a prime, so it is what sits underneath reducing a fraction, finding a common denominator, or working out a greatest common factor.
- How do I read the factor tree?
- Start at the number on top and read downwards. At each step the smallest prime that divides the number is taken out and drawn on the left branch, and whatever is left goes down the right branch to be broken up in turn. For 1,386 the tree reads 1,386 into 2 and 693, then 693 into 3 and 231, then 231 into 3 and 77, then 77 into 7 and 11. The tree stops when the right-hand number is itself prime. Collect every number on a left branch plus the last one on the right and you have the factorization: 2, 3, 3, 7, 11. The number you typed sits at the top in white, the primes taken out are drawn in the accent colour and the numbers still to be broken up are grey, so you can see at a glance which parts of the tree are finished.
- Why does 1 have no prime factors?
- Because 1 is not prime, and there is nothing left to take out of it. A prime is a number above 1 whose only divisors are 1 and itself, so 1 fails the definition at the first word. It is excluded on purpose rather than by accident: if 1 counted as a prime then 6 could be written as 2 × 3, or 1 × 2 × 3, or 1 × 1 × 2 × 3, and factorization would stop being unique. So 1 is where a factorization ends rather than something to factorize, and this tool says so instead of showing you an empty answer. Zero is refused for the opposite reason: every prime divides zero, so there is no list to write down.
- How many divisors does a number have?
- Add one to each exponent in the factorization and multiply them together. 1,386 is 2^1 × 3^2 × 7^1 × 11^1, so the count is (1 + 1) × (2 + 1) × (1 + 1) × (1 + 1) = 24. The reason is easier than it looks: any divisor is built by choosing how much of each prime to take, and for the 3 in 1,386 you can take none of it, one 3 or two, which is three choices. Multiply the choices and you have counted every divisor exactly once. The count is on the readout under the stage and it updates with the number, so a power of two like 1,024 shows 11 divisors, which is 2^0 up to 2^10, and any prime shows 2.
- How big a number can it factorize?
- Up to 10,000,000,000,000,000, which is ten thousand million million, or a 1 followed by sixteen zeros. Past that the tool refuses by name rather than spinning. The method is trial division, which tries every candidate divisor up to the square root of the number: at the ceiling that is around twenty-seven million divisions and takes a fraction of a second. The work grows tenfold for every two digits you add, so an eighteen-digit number already means a second or two of a frozen tab and a twenty-two digit one would take minutes, which is why the ceiling is where it is. Everything under the ceiling is exact, including numbers past 9,007,199,254,740,992, where a calculator working in ordinary floating point starts rounding. 9,007,199,254,740,993 is the first odd number it cannot hold, and here it comes back correctly as 3 × 107 × 28,059,810,762,433.
- Will it take a decimal, a fraction or a negative number?
- No, and it refuses rather than rounding one for you. Prime factorization is defined for whole numbers above 1, so 12.5 comes back with a message saying it is not a whole number and suggesting you multiply up until it is. A fraction is pointed at its top and its bottom, which are two whole numbers you can factorize separately, and that pair is what reduces the fraction anyway. A minus sign is refused with the note that the positive number has exactly the same prime factors. Thousands separators are fine as long as they group in threes, so 1,386 is read as 1386, while an unusual comma such as 1,5 is named rather than guessed at.
- Is anything uploaded, and is my number kept?
- Nothing is uploaded. The arithmetic runs in your browser and the page makes no request while you type. The number in the box and which form you had leading are remembered in this browser alone, so the page opens where you left it, and the Start over button at the top of the page forgets them. The Copy button puts the answer on your clipboard as plain text: for a composite that is the exponent form, the same factors written out and the divisor working, and for a prime it is the line saying so with its two divisors.
Exact for every whole number it accepts: the factors are found by trial division in exact integer arithmetic and multiply back to the number you typed. Above ten thousand million million it says the number is too large rather than guessing, because trial division stops being quick there.