GCD & LCM Calculator

Find the greatest common divisor (GCD) and least common multiple (LCM) of two whole numbers.

Result

GCD (greatest common divisor)

6

LCM (least common multiple)

36

How it works

LCM = (a × b) ÷ GCD

The greatest common divisor (GCD) is the largest number dividing both inputs; the least common multiple (LCM) is the smallest number both divide into. For 12 and 18, the GCD is 6 and the LCM is 36. The two are linked by an elegant identity: GCD × LCM = a × b. Find one and the other follows instantly — 6 × 36 = 216 = 12 × 18. The GCD itself is found by Euclid's algorithm, over two thousand years old and still what computers use: divide, keep the remainder, repeat until it reaches zero. Each has its own job. The GCD simplifies fractions (12/18 becomes 2/3 by dividing both by 6) and reduces ratios to lowest terms. The LCM finds common denominators for adding fractions, and answers cycle questions — two events every 12 and 18 days coincide every 36 days.

Advertisement

Frequently asked questions

How is the GCD found?

By Euclid's algorithm: repeatedly replace the larger number by the remainder of the division until one is zero.

How are GCD and LCM related?

For any two numbers, GCD × LCM = a × b.

What is the relationship between GCD and LCM?

GCD × LCM = a × b. So once you have the GCD, the LCM is simply (a × b) ÷ GCD — no extra work needed.

Advertisement

Related calculators