GCF and LCM Calculator
Enter 2 to 10 whole numbers to find their greatest common factor and least common multiple — with prime factorization and Euclidean algorithm steps shown for every calculation.
Separate whole numbers with commas or spaces — enter between 2 and 10 positive integers, each from 1 to 1,000,000,000.
Enter 2 to 10 whole numbers to see the GCF, LCM, and the steps behind them.
Why GCF × LCM equals the product
This identity only holds for exactly two numbers — with three or more numbers, GCF × LCM does not equal their product.
Prime factorization
Euclidean algorithm steps
With more than two numbers, the GCF is found by reducing pairs from left to right: gcd(gcd(a, b), c), and so on.
Every calculation runs in your browser — nothing is sent to a server.
Tap a card to copy the number
Finding the GCF and LCM without listing every factor by hand
The slow way to find a greatest common factor or least common multiple is to list out every factor (or the first dozen multiples) of each number and scan for matches. It works for small numbers but falls apart fast once the numbers get into the hundreds or thousands. This calculator uses the same two shortcuts a textbook teaches — prime factorization and the Euclidean algorithm — and shows every step, so you can check your own work or actually learn the method instead of just reading off an answer.
How to use this calculator
- Type 2 to 10 whole numbers into the box, separated by commas or spaces (e.g.
12, 18, 30). - The GCF and LCM appear instantly — tap either card to copy the number.
- Open Prime factorization to see each number broken into its prime factors.
- Open Euclidean algorithm steps to see the exact division-and-remainder steps used to find the GCF.
- With exactly two numbers, a note shows the GCF × LCM = a × b identity worked out with your actual numbers.
How the calculator computes each result
Prime factorization method. Break each number into prime factors — for example 12 = 2² × 3 and 18 = 2 × 3². The GCF is the product of every prime that appears in both factorizations, raised to the lowest power it appears with (2¹ × 3¹ = 6). The LCM is the product of every prime that appears in either factorization, raised to the highest power it appears with (2² × 3² = 36).
Euclidean algorithm. For the GCF specifically, there's a faster route that never needs factoring at all: divide the larger number by the smaller one, replace the larger number with the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCF. Once the GCF is known, the LCM follows from a single division: LCM(a, b) = (a × b) ÷ GCF(a, b).
Worked example — 48 and 18. 48 = 18 × 2 + 12. Next, 18 = 12 × 1 + 6. Next, 12 = 6 × 2 + 0 — remainder 0, so the GCF is 6. The LCM is then (48 × 18) ÷ 6 = 144.
Worked example — three numbers, 12, 18, and 30. The calculator reduces pairs left to right: gcd(12, 18) = 6, then gcd(6, 30) = 6, so the GCF is 6. For the LCM: lcm(12, 18) = 36, then lcm(36, 30) = 180, so the LCM is 180.
GCF vs LCM: what each one is for
| Use case | Which one | Why |
|---|---|---|
| Simplifying a fraction (e.g. 18⁄24) | GCF | Divide numerator and denominator by their GCF (6) to get 3⁄4 in one step. |
| Splitting items into equal groups with nothing left over | GCF | The GCF is the largest group size that divides every pile evenly. |
| Adding or comparing fractions with different denominators | LCM | The LCM of the denominators is the smallest common denominator to convert to. |
| Lining up repeating events (buses every 12 min, trains every 18 min) | LCM | The LCM tells you when both cycles next line up at the same time. |
The GCF × LCM shortcut — and its limit
For exactly two numbers, multiplying their GCF by their LCM always gives back the product of the two numbers: GCF(a, b) × LCM(a, b) = a × b. For 12 and 18 that's 6 × 36 = 216, and 12 × 18 is also 216. It's a handy way to sanity-check a two-number answer, or to find the LCM quickly once you already have the GCF.
This identity is a special property of exactly two numbers — it does not extend to three or more. For 4, 6, and 15: the GCF is 1 and the LCM is 60, so GCF × LCM = 60, but 4 × 6 × 15 = 360. The mismatch is expected — with three or more numbers there's no single formula that connects GCF, LCM, and the product this simply, which is exactly why the calculator only shows this note for two-number input.
Common mistakes
- Confusing GCF and LCM. GCF is always less than or equal to the smallest number entered; LCM is always greater than or equal to the largest. If your GCF comes out bigger than one of your numbers, something's off.
- Assuming GCF × LCM = product for three or more numbers. As shown above, that shortcut is only valid for exactly two numbers.
- Stopping the Euclidean algorithm too early. Keep dividing until the remainder is exactly 0 — the answer is the last divisor at that point, not the last remainder before it.
- Forgetting that coprime numbers still have an LCM. Two numbers with a GCF of 1 (like 7 and 13) are called coprime — their LCM is simply their product (91), which is often the largest possible LCM for numbers of that size.
Sources & further reading
Frequently asked questions
What are GCF and LCM, and how are they different?
The greatest common factor (GCF), also called the greatest common divisor (GCD), is the largest whole number that divides every number in the list with no remainder. The least common multiple (LCM) is the smallest whole number that every number in the list divides into evenly. For example, with 12 and 18: the GCF is 6 (the biggest number that divides both), and the LCM is 36 (the smallest number both divide into). GCF is used to simplify fractions and split things into equal groups; LCM is used to find a common denominator or line up repeating events.
How do you find the GCF using the Euclidean algorithm?
The Euclidean algorithm repeatedly divides the larger number by the smaller one and keeps the remainder, until the remainder reaches 0 — the last non-zero remainder is the GCF. Worked example for 48 and 18: 48 = 18 × 2 + 12, then 18 = 12 × 1 + 6, then 12 = 6 × 2 + 0. The remainder just hit 0, so the GCF is 6. This method is much faster than listing every factor, especially for large numbers, and this calculator shows every one of these division steps automatically.
How do you find the GCF and LCM of more than two numbers?
For three or more numbers, the calculator reduces them two at a time from left to right. For 12, 18, and 30: first find gcd(12, 18) = 6, then find gcd(6, 30) = 6 — so the GCF of all three is 6. The LCM works the same way: lcm(12, 18) = 36, then lcm(36, 30) = 180, so the LCM of all three is 180. This pairwise reduction always gives the correct answer because GCF and LCM are both associative — the order you combine the numbers in doesn't change the final result.
Why does GCF × LCM = a × b only work for two numbers?
For exactly two numbers, multiplying the GCF by the LCM always equals the product of the two original numbers — for 12 and 18, GCF × LCM = 6 × 36 = 216, which equals 12 × 18 = 216. This shortcut breaks down once a third number joins in: for 4, 6, and 15, the GCF is 1 and the LCM is 60, so GCF × LCM = 60, but 4 × 6 × 15 = 360 — the two numbers no longer match. The identity is a special property of pairs, not a general rule for any number of values.
Is my data sent to a server?
No. This calculator runs entirely in your browser — the numbers you enter, the GCF, the LCM, and every step shown are computed on your device and never uploaded anywhere. There's no sign-up and no tracking. Your last entry is saved only in this browser's local storage so it's there when you come back, and clearing your browser data removes it completely.