GCF and LCM Calculator

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

About this tool

The GCF is found with the Euclidean algorithm (repeatedly replace the pair with the second number and the remainder). The LCM then equals a x b / GCF. Example: 12 and 18 have GCF 6 and LCM 36.

FAQ

What is the difference between GCF and LCM?

The GCF is the largest number dividing both values; the LCM is the smallest number both values divide into.

When do I need the LCM?

To find a common denominator when adding fractions or when events repeat on different cycles.

Worked example

For 12 and 18: the factors of 12 are 1, 2, 3, 4, 6, 12 and of 18 are 1, 2, 3, 6, 9, 18, so the GCF is 6. The LCM is 12 x 18 / 6 = 36. The shortcut GCF x LCM = a x b works for any two positive integers.

Use the GCF to simplify fractions (12/18 = 2/3) and the LCM to find a common denominator when adding fractions (1/12 + 1/18 = 3/36 + 2/36 = 5/36).