Prime Factorization Calculator

Break any whole number into prime factors, with a factor tree, the list of divisors and a prime check. Works on numbers up to 40 digits, and also gives the divisor count, the sum of divisors and Euler’s totient.

Calculator Numbers & Math Updated Oct 3, 2026
How to Use
  1. Type a whole number, up to 40 digits. Commas are fine.
  2. Read the prime factorisation in exponent form, whether the number is prime, and how many divisors it has.
  3. The factor tree splits off the smallest prime at each step; the circled numbers are the primes.
  4. The table gives the expanded product, every divisor, the sum of divisors, Euler’s φ and whether the number is perfect, abundant or deficient.
  5. Show Work lists each division by the smallest prime.
Input
up to 40 digits
Presets
Factor tree
Prime factorisation
—
Prime?
—
Divisors
—
Sum of divisors
—

Worked Example

360. Halve it while you can: 360 → 180 → 90 → 45, three 2s. Then by 3: 45 → 15 → 5, two 3s. 5 is prime. So 360 = 2³ × 3² × 5. It has (3 + 1)(2 + 1)(1 + 1) = 24 divisors, and they add up to 15 × 13 × 6 = 1,170.

A perfect number. 28 = 2² × 7. Its divisors other than itself are 1, 2, 4, 7 and 14, which add up to exactly 28. Euclid showed that 2ᵖ⁻¹(2ᵖ − 1) is perfect whenever 2ᵖ − 1 is prime; here p = 3.

The common mistake: stopping at a composite leaf. Writing 360 = 2 × 2 × 2 × 45 leaves 45, which is 3 × 3 × 5. Keep going until every leaf is prime.

Show Work

Enter a number to see the step-by-step working.

Formulas

Factorisation
n = p₁^a₁ × p₂^a₂ × …
Number of divisors
d(n) = (a₁ + 1)(a₂ + 1)…
Sum of divisors
σ(n) = ∏ (p^(a+1) − 1)/(p − 1)
Euler’s totient
φ(n) = n ∏ (1 − 1/p)
Trial division limit
only primes p ≤ √n

The Atoms of Arithmetic

Euclid proved around 300 BC that there are infinitely many primes: multiply any finite list of them and add 1, and the result has a prime factor not on the list. That every number factors into primes in only one way was used for centuries but first proved carefully by Carl Friedrich Gauss in 1801.

Factoring stayed a curiosity until 1977, when the RSA cryptosystem made it the lock on internet security: multiplying two 300-digit primes is instant, but no known method recovers them from the product in any reasonable time. Pollard’s rho method (1975), used here, is a favourite for factors up to about 12 digits.

About This Calculator

This calculator factors whole numbers up to 40 digits using trial division, the Miller–Rabin primality test and Pollard’s rho method, and draws the factor tree. It lists every divisor (when there are up to 2,000), counts and sums them, gives Euler’s totient, and says whether the number is perfect, abundant or deficient.

Everything runs in your browser; nothing is sent anywhere.

Related calculators: GCF and LCM Calculator, Root Calculator, and Factorial Calculator.

Frequently Asked Questions

How do I find the prime factors of a number?

Divide by the smallest prime that goes in, and repeat on what is left. 360 ÷ 2 = 180, ÷ 2 = 90, ÷ 2 = 45, ÷ 3 = 15, ÷ 3 = 5, and 5 is prime. So 360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5. You only need to try primes up to the square root of what is left: if none divides it, it is prime.

Is the prime factorisation always the same?

Yes. The fundamental theorem of arithmetic says every whole number above 1 is a product of primes in exactly one way, apart from the order. A factor tree can start with any split, 360 = 10 × 36 or 360 = 8 × 45, and the leaves always come out as three 2s, two 3s and one 5.

How many divisors does a number have?

Add one to each exponent and multiply. 360 = 2³ × 3² × 5¹ has (3 + 1)(2 + 1)(1 + 1) = 24 divisors, because each divisor chooses 0 to 3 twos, 0 to 2 threes and 0 or 1 five. A number has an odd number of divisors exactly when it is a perfect square.

Is 1 a prime number?

No. A prime has exactly two divisors, 1 and itself, and 1 has only one. Leaving 1 out keeps factorisations unique: if 1 were prime, 6 could be 2 × 3, 1 × 2 × 3, 1 × 1 × 2 × 3 and so on. The smallest prime is 2, the only even one.

How can a 40-digit number be factored so quickly?

Trial division handles small primes, the Miller–Rabin test proves a number prime without searching for divisors, and Pollard’s rho method finds medium-sized factors in about the square root of their size in steps. Numbers that are a product of two primes of 20 digits each are still hard, which is what RSA encryption relies on, with primes hundreds of digits long.

How do I use the Prime Factorization Calculator?

Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Is it free? Does it work without internet?

Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.

Where does my data go?

Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.

Common Use Cases

Homework

360 = 2³ × 3² × 5, drawn as a factor tree.

Simplifying

√360 = √(2² × 3² × 10) = 6√10.

Puzzles

Project Euler 3: 600,851,475,143 has largest prime factor 6,857.

Number theory

28 = 1 + 2 + 4 + 7 + 14 is a perfect number.

Checking primes

1,000,000,007, the modulus used in coding contests, is prime.

Last updated: