Guide

How to Find GCD and LCM (and When to Use Each)

For 12 and 18, the greatest common divisor is 6 and the least common multiple is 36. GCD finds the largest number that divides both; LCM finds the smallest positive number that both divide into.

GCD and GCF mean the same thing

The greatest common divisor is also called the greatest common factor (GCF) or highest common factor (HCF). Factors divide a number without a remainder. The positive factors of 12 are 1, 2, 3, 4, 6, and 12; those of 18 are 1, 2, 3, 6, 9, and 18. Their largest shared factor is 6.

Use GCD to simplify a fraction: divide both 12 and 18 by 6, and 12/18 becomes 2/3. It also answers grouping questions: 12 red items and 18 blue items can form at most six identical groups using every item, with two red and three blue in each group.

LCM compares multiples, not factors

Multiples of 12 include 12, 24, 36, and 48. Multiples of 18 include 18, 36, and 54. The first positive number on both lists is 36, so their least common multiple is 36.

This helps with repeating cycles. If two reminders start together and repeat every 12 and 18 minutes, they next coincide after 36 minutes. Starting together matters: different starting times require more information than the two intervals alone.

Use prime factors for a hand calculation

Break the numbers into primes: 12 = 2² × 3 and 18 = 2 × 3². For the GCD, keep only shared primes at their smaller powers: 2 × 3 = 6. For the LCM, keep every prime at its larger power: 2² × 3² = 36.

If the numbers share no prime factors, their GCD is 1 and their LCM is their product. For 8 and 15, that gives GCD 1 and LCM 120. If one number divides the other, such as 6 and 24, the GCD is the smaller number and the LCM is the larger.

A shortcut: LCM = a × b ÷ GCD

For positive whole numbers, GCD × LCM = a × b. Once you know the GCD of 12 and 18 is 6, the LCM is (12 ÷ 6) × 18 = 36. Dividing first keeps intermediate numbers smaller.

The GCD can be found without listing every factor. Divide 18 by 12 to get remainder 6, then divide 12 by 6 to get remainder 0. The last nonzero remainder is the GCD, 6. This is the Euclidean algorithm, which the calculator uses.

Check two positive whole numbers

Enter First whole number and Second whole number. The GCD & LCM Calculator displays both results together. Each input must be a positive integer from 1 to 1,000,000; zero, negative numbers, and decimals are outside this tool's accepted range.

For fraction addition, the LCM of the denominators gives a convenient common denominator. For simplifying a fraction, use the GCD of its numerator and denominator. Keeping those two jobs separate makes it easier to choose the right result.

Try it yourself

Put this guide into practice with our free GCD & LCM Calculator — no sign-up, no download.

Open the GCD & LCM Calculator