GCF and LCM Calculator
Enter two or more whole numbers separated by commas to get the GCF and LCM, with the working.
What GCF and LCM mean
The greatest common factor (also called the greatest common divisor) is the biggest number that divides all your numbers. The least common multiple is the smallest number that all of them divide into. GCF is what you use to simplify fractions. LCM is what you use to find a common denominator.
The Euclidean algorithm
Listing factors works for small numbers but is slow for large ones. The Euclidean algorithm, described by Euclid around 300 BC, is faster. Divide the larger number by the smaller, keep the remainder, and repeat with the smaller number and that remainder until the remainder is 0.
Worked example: 12 and 18
18 = 1 × 12 + 6, then 12 = 2 × 6 + 0. The last non-zero remainder is 6, so GCF(12, 18) = 6. The LCM is 12 × 18 ÷ 6 = 36. By prime factors, 12 = 2² × 3 and 18 = 2 × 3². The GCF takes the lowest power of each prime (2 × 3 = 6) and the LCM takes the highest (2² × 3² = 36).
Where you will use them
Use the GCF to reduce 12/18 to 2/3. Use the LCM to add 1/12 + 1/18, where the common denominator is 36. LCM also solves timing problems, such as two buses that leave every 12 and 18 minutes and meet again after 36 minutes. For fractions in full, try the fraction calculator.
Frequently asked questions
What is the greatest common factor?
The GCF is the largest whole number that divides every number in the list with no remainder. The GCF of 12 and 18 is 6.
What is the least common multiple?
The LCM is the smallest positive number that every number in the list divides into evenly. The LCM of 12 and 18 is 36.
How are GCF and LCM related?
For two numbers, GCF × LCM equals the product of the numbers. 6 × 36 = 216 = 12 × 18. This shortcut works for pairs only, not for three or more.
What is the Euclidean algorithm?
It finds the GCF by repeatedly replacing the larger number with the remainder of dividing it by the smaller, until the remainder is 0. The last non-zero remainder is the GCF.
More Arithmetic and Fractions calculators
Browse every arithmetic and fractions calculator.