Smart Unit ConvertersSmart Unit Converters

LCM / GCD Calculator

Calculate Least Common Multiple and Greatest Common Divisor of integers.

?What is the LCM / GCD Calculator?

This calculator finds both the Greatest Common Divisor (GCD, also called Highest Common Factor or HCF) and the Least Common Multiple (LCM) of any list of positive integers. GCD is the largest integer that divides every value in your list; LCM is the smallest positive integer that every value divides into. These are essential for simplifying fractions (GCD of numerator and denominator), adding or subtracting fractions (LCM of denominators), scheduling repeating events, and many number-theory problems in competitive mathematics and cryptography.

The Formula

GCD via the Euclidean algorithm: GCD(a, b) = GCD(b, a mod b), repeated until b = 0. LCM identity: LCM(a, b) = |a × b| ÷ GCD(a, b). For more than two numbers, apply pairwise — the operation is associative.

Euclid's algorithm (published around 300 BC and still optimal for this problem) repeatedly replaces the pair (a, b) with (b, a mod b), shrinking the numbers rapidly. When b becomes 0, the remaining a is the GCD. The LCM follows from the beautiful identity LCM(a, b) × GCD(a, b) = a × b, which holds for all positive integers. For longer lists, just chain: GCD(a, b, c) = GCD(GCD(a, b), c). The same logic extends to LCM.

Practical Examples

1

12 and 18: GCD = 6, LCM = 36 — classic textbook example that also shows the identity 12 × 18 = 216 = 6 × 36.

2

8 and 12: GCD = 4, LCM = 24 — useful when simplifying 8/12 or finding a common denominator.

3

4, 6, and 10: GCD = 2, LCM = 60 — the minimum time at which three repeating events (every 4, 6, and 10 units) coincide.

4

Adding fractions: to add 1/4 + 1/6 + 1/10, the LCM of denominators (60) becomes the least common denominator.

5

Gear ratios: a gear with 24 teeth meshing with one of 36 teeth will return to the same relative position after LCM(24, 36) = 72 teeth of rotation.

6

Traffic lights: if three signals cycle every 30, 45, and 60 seconds, they synchronize every LCM(30, 45, 60) = 180 seconds (3 minutes).

Frequently Asked Questions

Yes. GCD (Greatest Common Divisor) and HCF (Highest Common Factor) are two names for the same concept. American textbooks often say GCD; British and Pakistani textbooks often say HCF. The value is identical — just different terminology.