What is gcf and lcm calculator?
The greatest common factor, or GCF, is the largest whole number that divides every number in a list without a remainder. It is also called the greatest common divisor or highest common factor. The least common multiple, or LCM, is the smallest number that every number in the list divides into evenly.
These two values are the basis of fraction work. The GCF reduces a fraction to its simplest form, and the LCM gives the common denominator needed to add fractions with different bottoms.
How to use the gcf and lcm calculator
- Type or paste two or more positive whole numbers.
- Separate them with commas, spaces or new lines.
- Read the GCF, the LCM and the prime factorization of every number.
How the gcf and lcm calculator works
The calculator finds the GCF with the Euclidean algorithm, which repeatedly replaces the larger number with the remainder of dividing it by the smaller one until the remainder is zero. The LCM of two numbers equals their product divided by their GCF, and it is extended to longer lists one number at a time.
It also factors each number into primes by trial division, so you can check the answer by hand. Exponents are shown as powers.
Worked example
Common uses of the gcf and lcm calculator
- Simplifying a fraction such as 18 over 30 to 3 over 5.
- Finding a common denominator to add fractions.
- Solving school math and number theory problems.
- Scheduling events that repeat on different cycles.
- Splitting items into equal groups with nothing left over.
Tips and common mistakes
The GCF of numbers that share no prime factor is 1. They are called coprime.
The LCM can grow very large for many numbers, so check that you really need all of them.
Background: what to know before you rely on it
The Euclidean algorithm is one of the oldest algorithms still in use, described by Euclid over two thousand years ago. It is fast because each step shrinks the numbers quickly, which is why even very large numbers can be handled in a fraction of a second.
A handy link between the two values for any pair of numbers is that GCF times LCM equals the product of the two numbers. That identity only holds for pairs, not for three or more numbers at once.
Private, free and fast
This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all calculators, or browse the full list of tools.
Field by field guide
- Numbers (separate with commas, spaces or new lines): Two to twenty positive whole numbers. The example is 12, 18, 30.
Change one field at a time to see how the result responds, and use the worked example above to check that you get the same answer.
Prime factor method
To find the GCF by hand, write each number as a product of primes and multiply the primes they share, using the lowest power. For the LCM, multiply every prime that appears, using the highest power.
The factorization line in the results lets you check each step.
Expert tips
- Use the GCF to reduce fractions in one step.
- Use the LCM to find the first time two cycles line up.
- For a pair, check that GCF times LCM equals the product.
- Negative numbers and zero are not accepted here.
- Large numbers up to one trillion are factored in full.
Frequently asked questions
What is the difference between GCF and LCM?
The GCF is the largest number that divides all of your numbers. The LCM is the smallest number that all of your numbers divide into.
Is GCF the same as GCD or HCF?
Yes. Greatest common factor, greatest common divisor and highest common factor mean the same thing.
Can I enter more than two numbers?
Yes. You can enter up to twenty numbers and the tool finds the GCF and LCM of the whole list.
What if the numbers have no common factor?
Then the GCF is 1 and the numbers are coprime.
Related tools
Fraction Calculator
Enter two fractions and an operation. The tool shows the simplified fraction, the mixed number and the...
CalculatorsRatio Calculator
Enter two numbers to simplify their ratio and add a third to find the matching missing value. Useful for...
CalculatorsAverage Calculator
The average, or mean, is the sum of the numbers divided by how many there are. This tool also gives the...
CalculatorsPrime Number Checker
Type a whole number to find out if it is prime. You also get the smallest factor, the prime...
CalculatorsScientific Calculator
Type an expression such as 2 * (3 + 4)^2 or sin(30) + sqrt(16). The calculator follows the order of...
CalculatorsPercentage Calculator
Use it for three jobs: find a percentage of a number, find what percent one number is of another, or...
Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional.