About this calculator
Enter two or more whole numbers to find their greatest common factor (GCF, also called the highest common factor or HCF) and their least common multiple (LCM). The prime factors of each number are shown so you can see where the answers come from.
Numbers can be as large as a trillion, and the results are exact.
Worked examples
Real numbers, worked out by the same calculator. Press “Use these numbers” to try one above.
12 and 18
- Greatest common factor (GCF)
- 6
- Least common multiple (LCM)
- 36
- Prime factors of 12
- 12 = 2² × 3
- Prime factors of 18
- 18 = 2 × 3²
The greatest common factor of 12 and 18 is 6 and the least common multiple is 36.
Show the working
- Break each number into its prime factors (shown above).
- The GCF uses only the primes every number shares, each to the lowest power it appears with.
- The LCM uses every prime that appears in any number, each to the highest power it appears with.
- Check: GCF × LCM = 6 × 36 = 216, which equals 12 × 18 = 216.
12, 18 and 30
- Greatest common factor (GCF)
- 6
- Least common multiple (LCM)
- 180
- Prime factors of 12
- 12 = 2² × 3
- Prime factors of 18
- 18 = 2 × 3²
- Prime factors of 30
- 30 = 2 × 3 × 5
The greatest common factor of 12, 18 and 30 is 6 and the least common multiple is 180.
Show the working
- Break each number into its prime factors (shown above).
- The GCF uses only the primes every number shares, each to the lowest power it appears with.
- The LCM uses every prime that appears in any number, each to the highest power it appears with.
- GCF = 6 and LCM = 180.
48 and 180
- Greatest common factor (GCF)
- 12
- Least common multiple (LCM)
- 720
- Prime factors of 48
- 48 = 2⁴ × 3
- Prime factors of 180
- 180 = 2² × 3² × 5
The greatest common factor of 48 and 180 is 12 and the least common multiple is 720.
Show the working
- Break each number into its prime factors (shown above).
- The GCF uses only the primes every number shares, each to the lowest power it appears with.
- The LCM uses every prime that appears in any number, each to the highest power it appears with.
- Check: GCF × LCM = 12 × 720 = 8,640, which equals 48 × 180 = 8,640.
Two numbers with nothing in common: 8 and 15
- Greatest common factor (GCF)
- 1
- Least common multiple (LCM)
- 120
- Prime factors of 8
- 8 = 2³
- Prime factors of 15
- 15 = 3 × 5
The greatest common factor of 8 and 15 is 1 and the least common multiple is 120.
Show the working
- Break each number into its prime factors (shown above).
- The GCF uses only the primes every number shares, each to the lowest power it appears with.
- The LCM uses every prime that appears in any number, each to the highest power it appears with.
- Check: GCF × LCM = 1 × 120 = 120, which equals 8 × 15 = 120.
What GCF and LCM mean
The greatest common factor is the biggest whole number that divides exactly into every number you give. The GCF of 12 and 18 is 6.
The least common multiple is the smallest number that every number divides into exactly. The LCM of 12 and 18 is 36.
Finding them with prime factors
Break each number into primes: 12 = 2² × 3 and 18 = 2 × 3².
- For the GCF, take each prime the numbers share, to the lowest power: 2¹ × 3¹ = 6.
- For the LCM, take every prime that appears anywhere, to the highest power: 2² × 3² = 36.
For two numbers there's a handy check: GCF × LCM = the two numbers multiplied together. Here 6 × 36 = 216 = 12 × 18.
Euclid's method for the GCF
For big numbers there's a faster way than factorising. Divide the larger number by the smaller and keep the remainder, then repeat with the smaller number and the remainder, until the remainder is zero. The last non-zero remainder is the GCF. For 48 and 180: 180 ÷ 48 leaves 36, 48 ÷ 36 leaves 12, and 36 ÷ 12 leaves 0, so the GCF is 12.
What they're used for
The GCF is used to simplify fractions: divide the top and bottom by it. The LCM is used to find a common denominator when adding fractions, and to work out when repeating events line up, such as two buses that leave every 12 and 18 minutes leaving together every 36 minutes.
Frequently asked questions
How do I find the GCF of two numbers?
List the prime factors of each and multiply the primes they share, using the lowest power of each. Or use Euclid's method: keep dividing and taking remainders until you reach zero.
How do I find the LCM?
Multiply all the primes that appear in either number, using the highest power of each. For two numbers you can also use LCM = (a × b) ÷ GCF.
Is GCF the same as HCF?
Yes. Greatest common factor, highest common factor and greatest common divisor all mean the same thing.
What if the GCF is 1?
The numbers are called coprime: they share no factors. Their LCM is then just their product, as with 8 and 15, whose LCM is 120.
Can I use more than two numbers?
Yes, up to ten. The GCF and LCM are found across all of them together.
Formulas tested against hand-worked answers. Last reviewed 29 September 2026. These calculators do arithmetic only; they are not financial, tax or legal advice.