Key facts
- LCM(12, 18, 30) = 180 and GCF(12, 18, 30) = 6.
- For two numbers, LCM(a, b) × GCF(a, b) = a × b.
- Use the LCM to find a common denominator for fractions; use the GCF to simplify fractions.
- GCF is also called the greatest common divisor (GCD) or highest common factor (HCF).
What are the LCM and GCF?
A multiple of a number is that number times a whole number: multiples of 4 are 4, 8, 12, 16 and so on. A factor divides a number exactly: factors of 12 are 1, 2, 3, 4, 6 and 12. The least common multiple of a set is the smallest multiple they all share. The greatest common factor is the largest factor they all share. The two ideas show up constantly when working with fractions, ratios, schedules and gear teeth.
How to use the LCM and GCF calculator
Type two or more positive whole numbers separated by commas or spaces. The calculator returns the LCM, the GCF and a table with each number’s prime factorization.
Methods and formulas
Prime factorization method
Write each number as a product of primes. The GCF multiplies the primes they share, each to its lowest power. The LCM multiplies every prime that appears, each to its highest power.
| Number | Prime factorization |
|---|---|
| 12 | 2² × 3 |
| 18 | 2 × 3² |
| 30 | 2 × 3 × 5 |
- GCF = 2¹ × 3¹ = 6 (2 and 3 appear in all three; 5 does not).
- LCM = 2² × 3² × 5 = 180.
Euclidean algorithm for the GCF
Repeatedly replace the larger number with the remainder after dividing by the smaller, until the remainder is zero. For GCF(84, 36): 84 ÷ 36 leaves 12; 36 ÷ 12 leaves 0. The GCF is 12. This is how the calculator works, and it is fast even for very large numbers.
The LCM from the GCF
LCM(a, b) = |a × b| ÷ GCF(a, b)For more than two numbers, apply it step by step: LCM(a, b, c) = LCM(LCM(a, b), c).
Worked examples: LCM and GCF
Example 1: adding fractions
To add 5/12 + 7/18, find LCM(12, 18) = 36. Then 5/12 = 15/36 and 7/18 = 14/36, so the sum is 29/36.
Example 2: simplifying a fraction
GCF(84, 126) = 42, so 84/126 = 2/3.
Example 3: when do events line up?
One bus leaves every 12 minutes and another every 20 minutes. Both left at 9:00. They next leave together after LCM(12, 20) = 60 minutes, at 10:00.
Example 4: tiling with the largest square
A floor is 270 cm by 210 cm. The largest square tile that fits exactly without cutting has side GCF(270, 210) = 30 cm, and you need 9 × 7 = 63 tiles.
Quick reference
| Numbers | GCF | LCM |
|---|---|---|
| 4, 6 | 2 | 12 |
| 6, 8 | 2 | 24 |
| 8, 12 | 4 | 24 |
| 9, 12 | 3 | 36 |
| 10, 15 | 5 | 30 |
| 12, 16 | 4 | 48 |
| 3, 4, 5 | 1 | 60 |
| 6, 10, 15 | 1 | 30 |
Mistakes to avoid with LCM and GCF
- Confusing the two. The GCF is never bigger than the smallest number; the LCM is never smaller than the largest.
- Multiplying the numbers to get the LCM. That gives a common multiple, but only the least one when the numbers share no factors.
- Using the highest powers for the GCF. GCF uses the lowest powers of shared primes; LCM uses the highest powers of all primes.
See also the prime factorization calculator and the fraction calculator.
GCF, LCM and the cicadas of 2024
The greatest common factor is found with the Euclidean algorithm, described by Euclid around 300 BCE and still the method computers use. The least common multiple follows from it: for two numbers, LCM × GCF = a × b. Fractions use both, the GCF to simplify and the LCM as the least common denominator.
The LCM explains a natural spectacle. Periodical cicadas in North America emerge every 13 or 17 years, and because 13 and 17 are both prime, their LCM is 221: a particular 13-year brood and 17-year brood appear together only once every 221 years. In spring 2024, Brood XIII (17-year) and Brood XIX (13-year) emerged together in Illinois for the first time since 1803, drawing coverage from scientists and the press. Biologists think prime cycles help cicadas avoid predators with shorter cycles. The LCM also schedules repeating events, such as when two buses on different timetables leave together or when gears return to the same position. In US schools, Common Core standard 6.NS.B.4 covers the GCF and LCM. To see the prime factors behind them, use the prime factorization calculator; to reduce a fraction, the simplify fractions calculator; and to add fractions with different denominators, the adding fractions calculator.
How this calculator works
- GCF of two or more numbers uses the Euclidean algorithm repeatedly: gcd(a, b) = gcd(b, a mod b).
- LCM uses lcm(a, b) = |a × b| ÷ gcd(a, b), applied across the list.
- The prime factorization of each number is shown, so you can see the shared and highest powers.
- Whole numbers only; big-integer arithmetic keeps large inputs exact.
Frequently asked questions
How do I find the LCM of two numbers?
Divide their product by their greatest common factor. LCM(8, 12) = 96 ÷ 4 = 24. You can also list multiples of each until you find the first one they share.
How do I find the GCF?
Use prime factorization and multiply the shared primes at their lowest powers, or use the Euclidean algorithm of repeated division.
What is the LCM of 6 and 8?
LCM(6, 8) = 24. The GCF is 2, and 48 ÷ 2 = 24.
What is the GCF of 24 and 36?
GCF(24, 36) = 12, since 24 = 2³ × 3 and 36 = 2² × 3², and the shared part is 2² × 3 = 12.
Is GCF the same as GCD and HCF?
Yes. Greatest common factor, greatest common divisor and highest common factor all mean the same thing.
What if the GCF is 1?
The numbers are called coprime or relatively prime. Their LCM is simply their product, as with 8 and 15 (LCM 120).
Why do I need the LCM for fractions?
The least common denominator of two fractions is the LCM of their denominators. Using it keeps the numbers as small as possible.
What is the LCM of 3, 4 and 5?
LCM(3, 4, 5) = 60, because the three numbers share no common factors, so the LCM is 3 × 4 × 5.