Skip to content
YouNeed Tools
Free VPN

LCM and GCF Calculator

Type two or more whole numbers to get their greatest common factor and least common multiple, with both methods worked out.

Greatest common factor (GCF, GCD, HCF)

6

Least common multiple (LCM)

180

Prime factors

  • 12 = 2² × 3
  • 18 = 2 × 3²
  • 30 = 2 × 3 × 5

GCF: take each prime the numbers share, at its lowest power: 2 × 3 = 6.

LCM: take every prime, at its highest power: 2² × 3² × 5 = 180.

Working

  1. 18 = 1 × 12 + 6
  2. 12 = 2 × 6 + 0
  3. GCF(12, 18) = 6
  4. 30 = 5 × 6 + 0
  5. GCF(6, 30) = 6

Worked out on your device.

Worked example

Find the GCF and LCM of 24 and 36. Prime factors: 24 = 2³ × 3 and 36 = 2² × 3². The GCF takes each shared prime at its lowest power, 2² × 3 = 12. The LCM takes every prime at its highest power, 2³ × 3² = 72. With Euclid: 36 = 1 × 24 + 12; 24 = 2 × 12 + 0, so the GCF is 12.

Common pairs

NumbersGCFLCM
4 and 6212
8 and 12424
9 and 15345
12 and 18636
15 and 20560
18 and 24672
21 and 28784
36 and 4812144

Using them with fractions

To simplify 24/36, divide the top and bottom by their GCF, 12, to get 2/3. To add 5/24 + 7/36, use the LCM of the denominators, 72: 5/24 = 15/72 and 7/36 = 14/72, so the sum is 29/72. The fraction calculator on this site does both automatically and shows the same steps.

Which method to use

Prime factorization shows why the answer is what it is and suits small numbers and homework that asks for factor trees or ladders. Euclid’s algorithm needs no factoring at all, so it is the way computers do it and the only practical method for very large numbers. Numbers that share no prime factor, such as 8 and 15, are called co-prime: their GCF is 1 and their LCM is simply their product.

Related tools

Sources

Checked on November 26, 2026:

Frequently asked questions

What is the GCF?
The greatest common factor is the largest whole number that divides all the numbers without a remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF). The GCF of 24 and 36 is 12.
What is the LCM?
The least common multiple is the smallest positive number that every one of the numbers divides into. The LCM of 4 and 6 is 12. It is the lowest common denominator when adding fractions.
How are the GCF and LCM related?
For two numbers, GCF × LCM = the product of the numbers. For 24 and 36: 12 × 72 = 864 = 24 × 36. This shortcut doesn’t hold for three or more numbers.
What is Euclid’s algorithm?
Divide the larger number by the smaller and keep the remainder; then divide the smaller number by that remainder, and so on. The last non-zero remainder is the GCF. It is fast even for very large numbers.
Can I use more than two numbers?
Yes, up to ten. The GCF and LCM are found two at a time: GCF(a, b, c) = GCF(GCF(a, b), c), and the same for the LCM.
Where is the LCM used in real life?
Whenever repeating things line up: two buses every 12 and 18 minutes leave together every 36 minutes; packs of 8 buns and 10 sausages match after 40 of each.

Last updated: 2026-11-26