LCM & GCF Calculator
Find the least common multiple (LCM) and the greatest common factor (GCF) of any two numbers — with the prime factors of each number shown so you can see how the answers are built. The LCM is the smallest number both numbers divide into; the GCF is the largest number that divides both.
How to use this converter
Enter two whole numbers. The LCM, the GCF and the prime factors of each number appear instantly.
Formula
GCF: the largest number that divides both. LCM = (a × b) ÷ GCF. Example: for 12 and 18, the GCF is 6 and the LCM is (12 × 18) ÷ 6 = 36. Prime factors: 12 = 2 × 2 × 3; 18 = 2 × 3 × 3.
You need the LCM to add fractions with different denominators, and the GCF to simplify fractions and ratios. Both come from the same prime factors.
Example LCM & GCF
| From | Equals |
|---|---|
| 12 and 18 | LCM 36 · GCF 6 |
| 4 and 6 | LCM 12 · GCF 2 |
| 7 and 5 | LCM 35 · GCF 1 |
| 360 | Prime factors: 2 × 2 × 2 × 3 × 3 × 5 |
Frequently asked questions
What is the LCM?
The least common multiple: the smallest number that both numbers divide into exactly. LCM(4, 6) = 12.
What is the GCF?
The greatest common factor: the largest number that divides both numbers exactly. GCF(12, 18) = 6. It is also called the GCD (greatest common divisor).
How are LCM and GCF related?
LCM(a, b) × GCF(a, b) = a × b. So once you know the GCF, the LCM is (a × b) ÷ GCF.
What if the two numbers have no common factor?
Then the GCF is 1 and the LCM is just a × b. For example, 7 and 5 are coprime: GCF 1, LCM 35.