Skip to content
Omnikalc

GCF and LCM calculator: greatest common factor and least common multiple

Find the greatest common factor and least common multiple of two or three whole numbers, and simplify their ratio.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Results

Greatest common factor (GCF)

6

Least common multiple (LCM)

180

First number ÷ GCF of the first two
2
Second number ÷ GCF of the first two
3
Check: GCF × LCM of the first two = a × b
216

With other second numbers

Greatest common factor (GCF)Least common multiple (LCM)
4 current260
8 current2120
9 current3180
15 current360
18 current6180
25 current1300

GCF and LCM in one place

The greatest common factor (GCF, also called greatest common divisor, GCD) of two whole numbers is the largest number that divides both exactly. The least common multiple (LCM) is the smallest positive number that both divide. The GCF simplifies fractions and ratios; the LCM finds common denominators and tells you when two repeating cycles line up again.

How they are calculated

Euclid’s algorithm finds the GCF quickly: replace the larger number by the remainder of the division of the two, and repeat until the remainder is 0. The last non-zero remainder is the GCF.

For 18 and 12: 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0, so GCF = 6.

The LCM follows from the GCF: LCM(a, b) = a × b ÷ GCF(a, b). For a third number, apply the same rules again: GCF(a, b, c) = GCF(GCF(a, b), c), and likewise for the LCM.

Worked example: 12, 18 and 30

  1. GCF(12, 18) = 6, then GCF(6, 30) = 6.
  2. LCM(12, 18) = 12 × 18 ÷ 6 = 36, then LCM(36, 30) = 36 × 30 ÷ 6 = 180.
  3. The fraction 12/18 simplifies to 2/3, dividing both by 6.
  4. Check: GCF × LCM of 12 and 18 = 6 × 36 = 216 = 12 × 18.

With prime factors

Another method writes each number as a product of primes: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. The GCF takes each common prime with its smallest exponent (2 × 3 = 6); the LCM takes every prime with its largest exponent (2² × 3² × 5 = 180).

GCF and LCM of 12 with other numbers

Second number GCF LCM
4 4 12
8 4 24
9 3 36
15 3 60
25 1 300

When the GCF is 1, the numbers are coprime, and their LCM is simply their product.

Where you use them

  • Adding fractions: 1/12 + 1/18 uses the LCM 36 as common denominator: 3/36 + 2/36 = 5/36.
  • Schedules: buses every 12 and 18 minutes leave together every 36 minutes.
  • Cutting and tiling: the largest square tile that fits a 120 × 180 cm area without cuts is 60 cm, the GCF.
  • Gears: two gears with 12 and 18 teeth return to the same position after 36 teeth have passed.

Frequently asked questions

How do you find the greatest common factor?

Use Euclid's algorithm: divide the larger number by the smaller, keep the remainder and repeat until the remainder is 0. The last non-zero remainder is the GCF.

How do you find the least common multiple?

Multiply the two numbers and divide by their GCF. For 12 and 18: 12 × 18 ÷ 6 = 36.

What is the GCF of 12 and 18?

6, the largest number that divides both. Their LCM is 36.

What does it mean when the GCF is 1?

The numbers are coprime: they share no factor other than 1, and their LCM is their product, as with 8 and 15.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.