LCM & GCF Calculator
- Prime factorizations: 12 = 2^2 × 3; 18 = 2 × 3^2.
- GCF: take the primes every number shares, at the lowest power — GCF(12, 18.0) = 6.
- LCM: take every prime at the highest power it appears — LCM = 36. Check with the first two numbers: 12 × 18 = GCF × LCM = 6 × 36 = 216. ✓
An lcm and gcf calculator finds the greatest common factor (GCF) and least common multiple (LCM) of two or more numbers. The GCF is the largest number that divides evenly into all of your inputs, while the LCM is the smallest number that each input divides into evenly. For two numbers, the product of the inputs always equals the product of the GCF and the LCM, so GCF(12, 18) = 6 and LCM(12, 18) = 36 because 12 x 18 = 216 and 6 x 36 = 216. The calculator handles three-number problems too, such as GCF(24, 36, 48) = 12 and LCM(24, 36, 48) = 144. It even identifies coprime pairs like 7 and 13, which share no factor and have a GCF of 1 and an LCM of 91.
The calculator relies on Euclid's algorithm, which finds the GCF through repeated remainders without any factoring, making it fast even for huge numbers. The prime factorization method then shows why the results hold: the GCF multiplies the primes all numbers share at the lowest power, while the LCM takes every prime at the highest power. The GCF shrinks fractions by dividing top and bottom by it, and the LCM finds the smallest common denominator and sync points for repeating events like buses or gears. This page shows the formula, step-by-step workings, worked examples and sources so you can verify every result yourself.
Worked examples
GCF and LCM of 12 and 18
GCF 6, LCM 36 — and 12 × 18 = 6 × 36 = 216, the identity that checks both. (12 · 18 · 0)
| GCF of 12, 18.0 | 6 |
| LCM | 36 |
| Are they coprime? | No — they share a factor of 6 |
24, 36 and 48 together
GCF 12, LCM 144 — three-number problems fold pairwise. (24 · 36 · 48)
| GCF of 24, 36.0, 48.00 | 12 |
| LCM | 144 |
| Are they coprime? | No — they share a factor of 12 |
7 and 13 share nothing
Coprime: GCF 1, and the LCM is just their product, 91. (7 · 13 · 0)
| GCF of 7, 13.0 | 1 |
| LCM | 91 |
| Are they coprime? | Yes — GCF is 1 |
Two questions about the same numbers
Two questions about the same numbers
GCF asks what divides all of them; LCM asks what all of them divide. Take the pair 12 and 18. The greatest common factor is the largest number that divides both of them evenly, which is 6. The least common multiple is the smallest number that both of them divide into evenly, which is 36. You can verify both results from the prime factorizations: 12 = 2^2 x 3 and 18 = 2 x 3^2. The GCF takes the primes they share at the lowest power, giving 2 x 3 = 6. The LCM takes every prime at the highest power, giving 2^2 x 3^2 = 36. A handy check confirms the work: for any two numbers, a x b = GCF x LCM. Here, 12 x 18 = 216, and 6 x 36 = 216.
The same idea extends to three numbers. For 24, 36, and 48, the GCF is 12 and the LCM is 144. The prime factorizations are 24 = 2^3 x 3, 36 = 2^2 x 3^2, and 48 = 2^4 x 3. The GCF multiplies the primes all three share at the lowest power: 2^2 x 3 = 12. The LCM takes every prime at the highest power: 2^4 x 3^2 = 144. Three-number problems also fold pairwise: lcm(24, 36) = 72, then lcm(72, 48) = 144.
Some pairs share no factor at all. GCF(7, 13) = 1 and LCM(7, 13) = 91. Two primes like 7 and 13 share nothing, so their LCM is simply their product. Such pairs are called coprime, or relatively prime. An lcm and gcf calculator handles these instantly, but behind the scenes it often relies on Euclid's algorithm, which finds the GCF by repeated remainders without any factoring. That method is fast even for huge numbers, and it is the logic behind the calculator's check.
These two values do real work. The GCF shrinks fractions: divide the top and bottom by it. The LCM finds the smallest common denominator and sync points for repeating events like buses or gears.
The prime factorization method, shown in full
The prime factorization method, shown in full
The prime factorization method, shown in full
The prime factorization method, shown in full
The prime factorization method, shown in full
The identity that checks your answer
For any two numbers, a simple identity confirms a correct result: a x b = GCF x LCM. Take 12 and 18. From 12 = 2^2 x 3 and 18 = 2 x 3^2, the GCF is 6 and the LCM is 36. Multiply the originals: 12 x 18 = 216. Now multiply the results: 6 x 36 = 216. The two products match, so the answer checks out. This relationship holds for every pair of whole numbers, which is why a reliable lcm and gcf calculator can flag an error before it ever reaches you.
The identity is convenient, but it does not extend to three numbers. For GCF(24, 36, 48) = 12 and LCM(24, 36, 48) = 144, the product of the inputs is 41,472, while the product of the results is 1,728 — no match. Instead, the calculator verifies three-number problems by direct division and multiples. It folds the work pairwise: lcm(24, 36) = 72, then lcm(72, 48) = 144. The prime factorization method still applies: the GCF multiplies the primes all numbers share at the lowest power (2^2 x 3 = 12), while the LCM takes every prime at the highest power (2^4 x 3^2 = 144).
Coprime pairs show the identity at its simplest. GCF(7, 13) = 1 and LCM(7, 13) = 91, because two primes share no factor, so their LCM is simply their product. Here a x b and GCF x LCM collapse to the same calculation. Euclid's algorithm finds the GCF by repeated remainders without any factoring, fast even for huge numbers, and the logic behind the calculator's check. Once verified, the GCF shrinks fractions by dividing top and bottom by it, while the LCM finds the smallest common denominator and sync points for repeating events like buses or gears.
How to use this LCM and GCF calculator
Enter two numbers to get started, or enter three numbers if you are working with a larger set. If you only need results for two numbers, set the third input to 0 and the calculator will skip it. The outputs include the GCF, the LCM, every prime factorization, and a verification line that confirms the result.
This LCM and GCF calculator follows the prime factorization method. The GCF multiplies the primes all numbers share, at the lowest power. The LCM takes every prime at the highest power. For example, with 12 and 18, the prime factorizations are 12 = 2^2 x 3 and 18 = 2 x 3^2. The shared primes are 2 and 3, so the GCF uses the lowest powers: 2 x 3 = 6. The LCM uses the highest powers: 2^2 x 3^2 = 36. The verification line shows that 12 x 18 = 216 = 6 x 36, confirming that for any two numbers, a x b = GCF x LCM.
For three-number problems, the results fold pairwise. Take 24, 36, and 48. The prime factorizations are 24 = 2^3 x 3, 36 = 2^2 x 3^2, and 48 = 2^4 x 3. The GCF multiplies the shared primes at the lowest power: 2^2 x 3 = 12. The LCM takes every prime at the highest power: 2^4 x 3^2 = 144. To get there, the calculator first finds lcm(24, 36) = 72, then lcm(72, 48) = 144. The same logic works for any combination of two or three inputs.
Some pairs share no common factor at all. For example, GCF(7, 13) = 1 and LCM(7, 13) = 91. Two primes share no factor, so their LCM is simply their product. Such pairs are called coprime, or relatively prime. Behind the scenes, the calculator relies on Euclid's algorithm, which finds the GCF by repeated remainders without any factoring. This method is fast even for huge numbers, and it is the logic behind the calculator's check.
- GCF shrinks fractions: divide the top and bottom by it to reduce to lowest terms.
- LCM finds the smallest common denominator and sync points for repeating events like buses or gears.
- Set the third input to 0 if you only need results for two numbers.
Where each one earns its keep
A capable lcm and gcf calculator does more than spit out two numbers — it hands you the right tool for the job. The GCF shrinks fractions by dividing the top and bottom by that shared factor, while the LCM finds the smallest common denominator and sync points for repeating events like buses or gears. Knowing which result to reach for turns a tedious problem into a one-step answer.
The GCF earns its keep any time you need to split things into the largest equal groups possible — arranging students into teams, cutting ribbon into equal pieces, or tiling a floor with the biggest square tiles that fit both dimensions. The LCM, on the other hand, handles anything that repeats on a cycle, from bus schedules to meshing gears, because it pinpoints the first moment the cycles line up again.
Both tools scale cleanly from two numbers to three. The verified three-number example GCF(24, 36, 48) = 12 and LCM(24, 36, 48) = 144 follows directly from the prime factorizations: 24 = 2^3 x 3, 36 = 2^2 x 3^2, and 48 = 2^4 x 3. The GCF multiplies the primes all numbers share at the lowest power (2^2 x 3 = 12), while the LCM takes every prime at the highest power (2^4 x 3^2 = 144). Three-number problems fold pairwise: lcm(24, 36) = 72, then lcm(72, 48) = 144.
| Use case | Tool | Worked example |
|---|---|---|
| Simplifying fractions | GCF | Divide top and bottom by GCF(12, 18) = 6 to simplify 12/18 to 2/3 |
| Common denominators | LCM | Use LCM(12, 18) = 36 as the smallest common denominator to add 1/12 + 1/18 |
| Largest equal groups and square tiles | GCF | GCF(24, 36, 48) = 12 gives the largest square tile fitting a 24 x 36 x 48 space |
| Repeating schedules | LCM | LCM(24, 36, 48) = 144 finds the first cycle where all three schedules realign |
Coprime numbers and edge cases
Some number pairs behave in ways that surprise people using an lcm and gcf calculator for the first time. Take 7 and 13. Both are prime, so they share no common factor. The GCF(7, 13) = 1, and the LCM(7, 13) = 91, which is simply 7 times 13. Pairs like this are called coprime (or relatively prime). Whenever two numbers are coprime, their LCM always equals their product, because there is no shared factor to remove. The relationship a x b = GCF x LCM still holds: 7 x 13 = 91 = 1 x 91.
Another edge case appears when one number divides the other exactly. If you enter 6 and 18, the GCF is the smaller number (6) and the LCM is the larger number (18). This follows from the definitions: the greatest common factor cannot exceed the smaller input, and the least common multiple cannot be below the larger input. The check still works — 6 x 18 = 108 = 6 x 18. The same logic applies to any pair where one value is a multiple of the other, such as 5 and 25 or 9 and 27.
Equal numbers form the simplest case of all. When both inputs are the same, the GCF and the LCM are both that number. For example, GCF(10, 10) = 10 and LCM(10, 10) = 10. The product check gives 10 x 10 = 100 = 10 x 10. This can feel odd at first glance — the largest common factor and the smallest common multiple are identical — but it makes sense when you consider that the only common factor and the only common multiple of interest are the number itself.
These edge cases all follow the same underlying rule: for any two positive integers, a x b = GCF x LCM. This identity is what lets the calculator verify its own output. Behind the scenes, it uses Euclid's algorithm, which finds the GCF by repeated remainders without any factoring — fast even for huge numbers. Once the GCF is known, the LCM follows directly from the product relationship, so both results are computed and checked in one consistent pass.
FAQs
What are the LCM and GCF of 12 and 18?
The GCF of 12 and 18 is 6, and the LCM is 36. You can verify this with a useful rule: for any two numbers, the product of the numbers always equals the product of their GCF and LCM. Here, 12 times 18 is 216, and 6 times 36 is also 216, confirming both values are correct.
How do you find the GCF using prime factorization?
To find the GCF using prime factorization, multiply the prime factors that all the numbers share, using the lowest power at which each appears. For example, with 24, 36 and 48 the shared part is 2^2 x 3, which gives a GCF of 12. Only primes present in every number count.
How do you find the LCM using prime factorization?
To find the LCM using prime factorization, take every prime that appears in any number at the highest power it reaches anywhere. For 24, 36 and 48 that means 2^4 x 3^2, which equals 144. This ensures the result is divisible by each original number without including unnecessary extra factors.
How do LCM and GCF work for three numbers?
For three numbers, fold pairwise. For GCF: gcd(24, 36) = 12, then gcd(12, 48) = 12. For LCM: lcm(24, 36) = 72, then lcm(72, 48) = 144. This calculator does all three at once, so you do not need to work through the pairs yourself.
When is the LCM just the two numbers multiplied together?
The LCM equals the two numbers multiplied together when the numbers are coprime, meaning their GCF is 1. For example, 7 and 13 are coprime, so their LCM is 91, which equals 7 x 13. With no shared factors, nothing overlaps, so nothing is saved and the product is the LCM.
What is the GCF used for in real life?
The GCF is used for simplifying fractions by dividing the numerator and denominator by it, splitting items into the largest possible equal groups, and finding the biggest square tile that fits a rectangle with no cutting. These practical tasks all rely on identifying the largest factor shared by the numbers involved.