LCM and GCF Calculator
Find the least common multiple (LCM) and greatest common factor (GCF) of 2 to 4 numbers, with prime factors and Euclid’s steps.
About this tool
Enter two, three or four whole numbers to get their least common multiple and greatest common factor (also called the greatest common divisor, GCD, or highest common factor, HCF). The calculator shows the prime factorization of every number, how the LCM and GCF follow from it, and the steps of Euclid’s algorithm for the first two numbers – handy for homework, common denominators and checking your working.
Frequently asked questions
The LCM is the smallest positive number that all the numbers divide into. For 6, 8 and 9 it is 72: 72 ÷ 6 = 12, 72 ÷ 8 = 9 and 72 ÷ 9 = 8, and no smaller number works for all three. With prime factors, take every prime at its highest power: 6 = 2 × 3, 8 = 2³, 9 = 3², so the LCM is 2³ × 3² = 72.
The GCF – also called the greatest common divisor (GCD) or highest common factor (HCF) – is the largest number that divides all the numbers. For 12 and 18 it is 6. With prime factors, take only the primes they share, at the lowest power: 12 = 2² × 3 and 18 = 2 × 3², so the GCF is 2 × 3 = 6.
Divide the larger number by the smaller and keep the remainder, then repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF. For 456 and 168: 456 = 2 × 168 + 120, 168 = 1 × 120 + 48, 120 = 2 × 48 + 24, 48 = 2 × 24 + 0, so the GCF is 24.
For two numbers, LCM × GCF = the product of the numbers, so LCM = a × b ÷ GCF. For 12 and 18: 12 × 18 = 216 and 216 ÷ 6 = 36. This shortcut does not work for three or more numbers: 6 × 8 × 9 = 432, but the LCM is 72 and the GCF is 1. To add fractions, use the LCM of the denominators as the common denominator: 1/6 + 3/8 = 4/24 + 9/24 = 13/24.
Related tools
Mean, Median and Mode CalculatorFind the mean (average), median, mode and range of up to 12 numbers, with the sorted list and the working shown.Fraction CalculatorAdd, subtract, multiply or divide two fractions and get the simplified answer, mixed number and decimal.Ratio CalculatorSolve a proportion A : B = C : ? and simplify a ratio to its lowest terms.Percentage CalculatorWork out percentages three ways: X% of a number, what percent one number is of another, and the change between two values.Quadratic Equation CalculatorSolve ax² + bx + c = 0 with the quadratic formula: real or complex roots, discriminant, vertex and factored form, with working.