Skip to content
LoveToCalc

Prime factorisation

Divide by the smallest prime that goes, again and again. What is left are the number's building blocks.

In Swedish: Primtalsfaktorisering

The rule

A prime is a whole number greater than 1 that is divisible only by 1 and itself: 2, 3, 5, 7, 11, 13 and so on, see the table of primes. Every whole number greater than 1 is either a prime or a product of primes, and the product is the same however you arrive at it, apart from the order. That is the fundamental theorem of arithmetic.

To factorise a number into primes is to find that product:

  1. Divide the number by the smallest prime that goes exactly, starting with 2.
  2. Keep dividing the quotient by the same prime for as long as it goes.
  3. Move on to the next prime: 3, 5, 7, …
  4. Stop when the quotient is 1. The primes you divided by are the factors.

You only need to try primes up to the square root of what is left. If none of them goes, what is left is itself a prime.

Worked examples

360. 360 / 2 = 180, 180 / 2 = 90, 90 / 2 = 45. 45 cannot be divided by 2, but 45 / 3 = 15 and 15 / 3 = 5, and 5 is a prime. So

360 = 2 · 2 · 2 · 3 · 3 · 5 = 2³ · 3² · 5

84. 84 / 2 = 42, 42 / 2 = 21, 21 / 3 = 7. So 84 = 2² · 3 · 7.

1001. Neither 2, 3 nor 5 goes. 1001 / 7 = 143, and 143 / 11 = 13. So 1001 = 7 · 11 · 13.

97. The square root of 97 is just under 10, so it is enough to try 2, 3, 5 and 7. None of them goes, so 97 is a prime.

A factor tree is the same method drawn: the number at the top, two branches for every split, and the primes as leaves. It does not matter whether you start with 360 = 36 · 10 or 360 = 8 · 45; the leaves come out the same.

The prime factorization calculator does the same divisions for any number and shows every step.

What the factors are for

Common mistakes

Common questions

Why is the factorisation always the same? That is the fundamental theorem of arithmetic. It rests on the fact that a prime dividing a product must divide one of the factors, so two different sets of primes can never give the same product.

How do you know when to stop trying? When the prime squared is larger than what is left. If what is left has a factor, it also has one no larger than its square root.

Is 2 the only even prime? Yes. Every other even number is divisible by 2 and so has a divisor besides 1 and itself.

Prime numbers up to 1,000

Table

Prime numbers up to 1,000
2357111317192329
31374143475359616771
7379838997101103107109113
127131137139149151157163167173
179181191193197199211223227229
233239241251257263269271277281
283293307311313317331337347349
353359367373379383389397401409
419421431433439443449457461463
467479487491499503509521523541
547557563569571577587593599601
607613617619631641643647653659
661673677683691701709719727733
739743751757761769773787797809
811821823827829839853857859863
877881883887907911919929937941
947953967971977983991997

Divisibility rules

Table

Divisibility rules
Divisible byRuleExampleCounterexample
2The last digit is even.124125
3The digit sum is divisible by 3.126127
4The last two digits form a number divisible by 4.168169
5The last digit is 0 or 5.210211
6The number is divisible by both 2 and 3.252253
8The last three digits form a number divisible by 8.336337
9The digit sum is divisible by 9.378379
10The last digit is 0.420421
11The digits alternately added and subtracted give a number divisible by 11.462463
25The last two digits are 00, 25, 50 or 75.1,0501,051

Last reviewed September 24, 2026 ·How pages are reviewed

Calculate it in practice

ArithmeticAll formulas