How to find the GCF and LCM
The greatest common factor (GCF) and least common multiple (LCM) show up when you simplify or add fractions and solve sharing and timing problems. This guide shows prime factorisation and Euclid's algorithm with worked examples.
The short version
- Write each number as a product of primes. For example 12 = 2 × 2 × 3.
- GCF: multiply the primes that appear in every number, each to its lowest power.
- LCM: multiply every prime that appears anywhere, each to its highest power.
- Check with a shortcut. For two numbers, GCF × LCM = their product.
Skip the arithmetic. The free GCF & LCM Calculator does this for you, shows the formula and the working with your own numbers, and runs in your browser - nothing you type is uploaded. Also useful: Fraction Calculator.
Method 1: prime factorisation
Find the GCF and LCM of 8, 12 and 20.
Method 2: Euclid's algorithm (for the GCF)
Divide the larger number by the smaller and keep the remainder. Repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF.
It is much faster than factorising when the numbers are large, such as 1,071 and 462, where 1,071 = 2 × 462 + 147, 462 = 3 × 147 + 21 and 147 = 7 × 21 + 0, so the GCF is 21.
Method 3: listing
List the multiples or factors of each number and look for the first or largest match. For 4 and 6 the multiples are 4, 8, 12 and 6, 12, so the LCM is 12. Listing is fine for small numbers and is how most people first learn it.
The shortcut for two numbers
So once you have the GCF you can find the LCM as (a × b) ÷ GCF. The shortcut does not extend to three or more numbers.
Where you use them
- Simplifying fractions: divide top and bottom by the GCF. 18/24 → GCF 6 → 3/4.
- Adding fractions: the lowest common denominator is the LCM of the denominators.
- Sharing: the GCF is the largest group size that splits several amounts evenly - 24 pens and 36 pencils make at most 12 identical packs.
- Repeating events: the LCM is when they line up. Buses every 12 and 18 minutes leave together every 36 minutes.