What Are the GCF and LCM?
The greatest common factor (GCF) of two or more whole numbers is the largest number that divides all of them exactly. It's also called the greatest common divisor (GCD) or highest common factor (HCF). For example, the GCF of 12 and 18 is 6, because 6 is the biggest number that goes into both. The least common multiple (LCM) is the smallest positive number that all of them divide into. The LCM of 12 and 18 is 36.
These two ideas come up constantly in maths: simplifying fractions (divide top and bottom by the GCF), adding fractions with different denominators (use the LCM as the common denominator), solving scheduling problems ("when will two buses next arrive together?"), tiling and packaging problems, and number theory and cryptography. This free calculator works for any number of integers, even huge ones, and shows the working.
How to Use the GCF and LCM Calculator
- Enter two or more whole numbers, separated by commas or spaces.
- Read the GCF and LCM at the top.
- Study the working: prime factorisations, the Euclidean algorithm (for two numbers) and factor lists.
Method 1: Prime Factorisation
Write each number as a product of primes. The GCF multiplies the primes they share, each raised to its lowest power; the LCM multiplies every prime that appears, each raised to its highest power.
- 48 = 24 × 3 and 180 = 22 × 32 × 5
- GCF = 22 × 3 = 12
- LCM = 24 × 32 × 5 = 720
Method 2: The Euclidean Algorithm
Over 2,300 years old and still the fastest method, Euclid's algorithm repeatedly divides the larger number by the smaller and replaces the pair with (smaller, remainder) until the remainder is zero. The last non-zero remainder is the GCF.
| Step | Division |
|---|---|
| 1 | 1071 = 2 × 462 + 147 |
| 2 | 462 = 3 × 147 + 21 |
| 3 | 147 = 7 × 21 + 0 → GCF = 21 |
Once you have the GCF of two numbers, the LCM follows from LCM(a, b) = a × b ÷ GCF(a, b). For more than two numbers, apply the calculation pairwise: GCF(a, b, c) = GCF(GCF(a, b), c), and likewise for the LCM.
Method 3: Listing Factors
For small numbers, list all the factors of each number and find the largest one they have in common. The calculator highlights common factors in the lists. This method is great for learning but slow for big numbers, which is why the factor lists are shown only for numbers up to one million.
Features
- Any number of inputsTwo, three or up to fifty numbers at once.
- Huge numbersExact arithmetic with arbitrarily large integers.
- Three methods shownPrime factorisation, Euclid's algorithm and factor lists.
- Coprime checkTells you when numbers share no common factor.
- Instant resultsUpdates as you type.
- Great for homeworkLearn the method, not just the answer.
Real-World Examples
- Simplifying fractions: 48/180 simplifies to 4/15 by dividing both by the GCF of 12.
- Adding fractions: for 1/12 + 1/18, the LCM 36 is the lowest common denominator: 3/36 + 2/36 = 5/36.
- Scheduling: if one light flashes every 12 seconds and another every 18, they flash together every 36 seconds (the LCM).
- Tiling: the largest square tile that exactly covers a 48 × 180 cm area is 12 cm (the GCF).
GCF and LCM in Everyday Problems
Word problems usually hint at which one you need. If the question asks for the largest equal group, the biggest tile that fits exactly, or the most identical gift bags you can make, you need the GCF. If it asks when two repeating events next happen together, or for the smallest quantity that can be split evenly in several ways, you need the LCM. For example, buses leaving every 12 and 18 minutes next depart together after LCM(12, 18) = 36 minutes, while 24 apples and 36 oranges make at most GCF(24, 36) = 12 identical fruit bags.
Frequently Asked Questions
What is the relationship between GCF and LCM?
For two numbers, GCF × LCM = a × b. For 12 and 18: 6 × 36 = 216 = 12 × 18.
What is the GCF of 12 and 18?
6. The factors of 12 are 1, 2, 3, 4, 6, 12 and of 18 are 1, 2, 3, 6, 9, 18; the largest common one is 6.
What is the LCM of 4, 6 and 8?
24, the smallest number that 4, 6 and 8 all divide into.
Are GCF, GCD and HCF the same?
Yes. They're three names for the same thing, used in different countries and textbooks.
What does coprime mean?
Two numbers are coprime (relatively prime) when their GCF is 1, like 8 and 15.
How are GCF and LCM related?
For two numbers, GCF × LCM = the product of the numbers. For 12 and 18: 6 × 36 = 216 = 12 × 18.