Free Online LCM & GCF Calculator
Find the least common multiple and greatest common factor with steps.
Use positive whole numbers. Up to 12 values, each no larger than 1,000,000,000.
Step-by-step working
- Enter at least two numbers to see the working.
Prime factorizations
| Number | Prime factorization |
|---|---|
| Prime factorizations will appear here. | |
About the LCM & GCF Calculator
The least common multiple and greatest common factor are two sides of the same divisibility relationship. The GCF is the largest number that divides a set of integers without a remainder. The LCM is the smallest number that each of those integers divides exactly. This calculator accepts two or more positive whole numbers and returns both values with the Euclid steps and prime factorizations used to find them.
Euclid's algorithm
The GCF is computed with Euclid's algorithm, one of the oldest algorithms still in daily use. Divide the larger number by the smaller one, keep the remainder, then replace the larger number with the smaller number and the smaller number with the remainder. Repeat until the remainder is zero. The last non-zero remainder is the GCF. For a list of numbers, the process is repeated cumulatively: find the GCF of the first two, then combine that result with the third number, and so on.
Computing the LCM
Once the GCF of two numbers is known, the LCM is their product divided by the GCF. That identity avoids listing every multiple and keeps the calculation fast even for large values. The decimal result can become very long when many numbers share few factors, so the LCM is calculated with arbitrary-precision integers internally.
Prime factorizations
The table breaks every input into its prime building blocks. Comparing the factorizations explains both answers: the GCF takes the smallest exponent of each shared prime, while the LCM takes the largest exponent of every prime that appears. For example, 12 = 2² × 3 and 18 = 2 × 3², so the GCF is 2 × 3 = 6 and the LCM is 2² × 3² = 36.
Frequently asked questions
Can I use more than two numbers?
Yes. Enter up to 12 positive whole numbers separated by commas, spaces, or line breaks.
What is the GCF of numbers with no shared factor?
If the only common divisor is 1, the GCF is 1 and the numbers are called coprime. The LCM is then the product of all the values.
Why is the LCM sometimes much larger than the inputs?
The LCM must contain every prime factor at its highest power. Values with few shared factors can produce a multiple far larger than any individual number.