What GCF and LCM are
The greatest common factor (GCF) of a set of numbers is the largest whole number that divides all of them with no remainder. The least common multiple (LCM) is the smallest positive whole number that every one of them divides into. They are two sides of the same coin: the GCF looks “downward” for the biggest factor the numbers share, while the LCM looks “upward” for the first multiple where they all line up.
They show up constantly with fractions. The LCM of the denominators is the least common denominator you need to add or subtract them; the GCF lets you simplify a fraction by dividing the top and bottom by it. They also help with even splits, with syncing repeating cycles (two lights blinking at different rates), and with cutting equal-sized pieces without waste.
Everything here runs in your browser — nothing is uploaded or stored.
How to use the calculator
- Type two or more positive whole numbers into the field, separated by commas or spaces (for example
12, 18or8 12 20). - Read the results instantly: the GCF on the dark card and the LCM on the light card.
- Below them you get a step-by-step Euclidean algorithm for the first pair of numbers.
- Press Copy result to grab both values, or Use example to load a ready-made case.
If you type anything that is not a positive whole number (letters, decimals, zero, or negatives), you’ll see a gentle notice and no calculation until you fix the input.
The method
The GCF uses the Euclidean algorithm: divide the larger number by the smaller one, keep the remainder, and repeat with the divisor and that remainder until the remainder is zero. The last divisor (the last non-zero remainder) is the GCF.
The LCM leans on the link between the two:
LCM(a, b) = a × b / GCF(a, b)
With more than two numbers you chain the steps: compute the LCM of the first two, combine that with the next one, and so on. The same chaining works for the GCF.
| Numbers | GCF | LCM |
|---|---|---|
| 12, 18 | 6 | 36 |
| 8, 12, 20 | 4 | 120 |
| 24, 36, 60 | 12 | 360 |
| 7, 13 | 1 | 91 |
| 15, 25 | 5 | 75 |
| 48, 180 | 12 | 720 |
Worked example
Let’s compute the GCF and LCM of 12 and 18. Apply Euclid:
- 18 = 12 × 1 + 6
- 12 = 6 × 2 + 0
The last non-zero remainder is 6, so GCF(12, 18) = 6. Now the LCM:
LCM = 12 × 18 / 6 = 216 / 6 = 36
So LCM(12, 18) = 36.
With three numbers, say 8, 12, and 20, you chain the steps. The GCF: GCF(8, 12) = 4 and GCF(4, 20) = 4, so GCF(8, 12, 20) = 4. The LCM: LCM(8, 12) = 24, then LCM(24, 20) = 24 × 20 / GCF(24, 20) = 480 / 4 = 120, so LCM(8, 12, 20) = 120.
Frequently asked questions
What’s the difference between GCF and LCM?
The GCF is the largest number that divides all your values; it is never larger than the smallest of them. The LCM is the smallest number they all divide into; it is never smaller than the largest of them. One shrinks, the other grows.
Why use the Euclidean algorithm?
Because it’s fast and doesn’t require factoring. Breaking large numbers into prime factors can be slow, whereas Euclid reaches the GCF in a handful of successive divisions. Once the GCF is known, the LCM comes from a single multiplication and division.
Can I enter more than two numbers?
Yes. Type as many as you like, separated by commas or spaces. The calculator combines the values two at a time for both the GCF and the LCM, and the answer is the same regardless of the order.
What if two numbers share no factors?
Then they are coprime and their GCF is 1. In that case the LCM is simply the product of the two. For example, 7 and 13 share no factors: GCF = 1 and LCM = 7 × 13 = 91.
Does it help simplify fractions?
Yes. Divide the numerator and denominator of a fraction by their GCF and you get the equivalent fraction already reduced to lowest terms. To add fractions, the LCM of the denominators is the smallest common denominator.