LCM & GCD Calculator
Free LCM and GCD (HCF) calculator — least common multiple and greatest common divisor of two or more whole numbers.
Free LCM and GCD (HCF) calculator — least common multiple and greatest common divisor of two or more whole numbers.
Enter two or more whole numbers separated by commas or spaces. You'll get both the greatest common divisor (GCD/HCF) and the least common multiple (LCM).
0 valid whole numbers detected.
Divide top and bottom by the GCD to reduce a fraction to lowest terms.
Find the least common denominator so unlike fractions can be combined.
Work out when two recurring events next coincide.
Verify Euclidean-algorithm working and prime-factorisation answers.
Find when two repeating patterns line up again — useful in music, gears and scheduling.
Find the largest tile or box size that divides two dimensions exactly.
The greatest common divisor is the largest number that divides both values exactly — for 12 and 18 it is 6. The least common multiple is the smallest number both divide into — for 12 and 18 it is 36. They are complementary: GCD strips a pair down to what they share, LCM builds up to the smallest thing that contains both. The diagram shows this as overlapping prime factors.
For the GCD, the Euclidean algorithm is fastest: divide the larger by the smaller, replace the pair with the smaller and the remainder, repeat until the remainder is zero. For 48 and 18: 48÷18 leaves 12, then 18÷12 leaves 6, then 12÷6 leaves 0, so the GCD is 6. For the LCM, multiply the two numbers and divide by their GCD — 48×18÷6 = 144.
Break each number into primes. 12 is 2×2×3 and 18 is 2×3×3. The GCD is the product of the factors they share, counting duplicates — one 2 and one 3, giving 6. The LCM is the product of every factor at its highest power in either number — 2×2×3×3, giving 36. Counting duplicates correctly is the part people get wrong: 8 and 12 share 2×2, not just a single 2.
For two numbers, yes: GCD × LCM = a × b, always. It is a useful check on your working. Importantly, it does not extend to three or more numbers — for 4, 6 and 10 the GCD is 2 and the LCM is 60, and 2×60 is nowhere near 240. Applying the two-number shortcut to a longer list is a common source of wrong answers.
GCD simplifies fractions: divide numerator and denominator by it and you have the fraction in lowest terms. LCM finds common denominators for adding fractions, and answers scheduling questions — two buses leaving every 12 and 18 minutes coincide every 36 minutes. Beyond arithmetic, GCD underpins modular arithmetic and the Euclidean algorithm is a building block of RSA cryptography.
Then their GCD is 1 and they are called coprime or relatively prime. Their LCM is simply their product — 7 and 13 give a GCD of 1 and an LCM of 91. Coprimality does not require either number to be prime: 8 and 9 are coprime despite both being composite. In the Venn diagram the circles have no overlap at all.