How to use the LCM and GCF calculator
- Type two or more whole numbers, separated by commas or spaces. Very large numbers stay exact.
- Read the GCF and LCM at once.
- Check the working: each number's prime factors and, for two numbers, every step of the Euclidean algorithm.
Formulas
GCF(a, b) = GCF(b, a mod b), until the remainder is 0
LCM(a, b) = |a × b| ÷ GCF(a, b)
For more than two numbers, apply them one pair at a time: GCF(12, 18, 30) = GCF(GCF(12, 18), 30) = GCF(6, 30) = 6, and LCM(12, 18, 30) = LCM(36, 30) = 180.
When you need them
- Simplifying fractions: divide top and bottom by their GCF. 18/24 → GCF 6 → 3/4.
- Adding fractions: the LCM of the denominators is the lowest common denominator.
- Scheduling: buses every 12 and 18 minutes leave together every LCM = 36 minutes.
- Tiling and packing: the largest square tile that fits a 12 × 18 floor exactly is GCF = 6 units.
Working with fractions? Use the fraction calculator.
Frequently asked questions
The greatest common factor (also called the greatest common divisor, GCD, or highest common factor, HCF) is the largest whole number that divides every number in the list with no remainder. The GCF of 12 and 18 is 6.
The least common multiple is the smallest positive number that every number in the list divides into. The LCM of 4 and 6 is 12. It's the lowest common denominator you need when adding fractions such as 1/4 + 1/6.
Write each number as a product of primes. The GCF takes each prime that appears in every number, to its lowest power; the LCM takes every prime that appears anywhere, to its highest power. 12 = 2² × 3 and 18 = 2 × 3², so the GCF is 2 × 3 = 6 and the LCM is 2² × 3² = 36.
For two numbers, LCM × GCF = a × b. So once you know the GCF you can get the LCM: LCM(12, 18) = 12 × 18 ÷ 6 = 36. This doesn't hold for three or more numbers.
A fast way to find the GCF of two numbers: divide the larger by the smaller, then replace the larger with the remainder and repeat until the remainder is 0. The last non-zero remainder is the GCF. The calculator lists each step.