CALCULATOR

GCF & LCM Calculator

Find the greatest common factor and least common multiple of two to ten numbers, with the work shown.

About this GCF and LCM calculator

This calculator finds the greatest common factor (GCF) and the least common multiple (LCM) of two to ten positive whole numbers at once. The GCF is also called the greatest common divisor (GCD) or the highest common factor (HCF). All three names mean the same thing: the largest whole number that divides every number in your list with no remainder. The LCM is the smallest positive number that every number in your list divides into evenly.

Along with the two answers, the tool shows its work. You get each step of the Euclidean algorithm, the prime factorization of every number with a table that picks out the lowest and highest power of each prime, a list of all the common factors, and, for two numbers, the fraction in lowest terms. Everything runs in your browser. Nothing you type is sent anywhere.

How to use the GCF and LCM calculator

  1. Type your numbers in the box, separated by commas or spaces. Use whole numbers of 1 or more, up to 18 digits each.
  2. Click Find GCF & LCM. The results update as you type as well.
  3. Read the two answers at the top, then scroll for the Euclidean steps, the prime factor table and the common factors.
  4. Use Copy result to paste the answer and the numbers into your notes or homework.

Three ways to find the GCF

MethodHow it worksBest for
List the factorsWrite every factor of each number and pick the largest one they shareSmall numbers, teaching the idea
Prime factorizationFactor each number into primes and multiply the primes they share, using the lowest power of eachShowing the GCF and LCM side by side
Euclidean algorithmDivide, keep the remainder, and repeat until the remainder is 0. The last nonzero remainder is the GCFLarge numbers, because no factoring is needed

The Euclidean algorithm rests on one fact: the GCF of two numbers does not change when you replace the larger number with its remainder after dividing by the smaller one. For 48 and 18, 48 = 2 × 18 + 12, then 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0. The last nonzero remainder is 6, so the GCF of 48 and 18 is 6. To handle more than two numbers, the tool finds the GCF of the first two, then the GCF of that answer and the third number, and so on.

How the LCM is found

With prime factorizations, the GCF uses the lowest power of each shared prime and the LCM uses the highest power of every prime that appears in any number. For 24 = 23 × 3, 36 = 22 × 32 and 60 = 22 × 3 × 5, the lowest powers shared by all three give 22 × 3 = 12, and the highest powers give 23 × 32 × 5 = 360.

For exactly two numbers there is a shortcut: GCF × LCM = the first number × the second number. So LCM = (a × b) ÷ GCF. For 48 and 18 that is (48 × 18) ÷ 6 = 144. The tool checks this identity for you when you enter two numbers. It does not hold for three or more numbers, so the tool builds the LCM step by step instead.

Worked example: 24, 36 and 60

The default numbers are 24, 36 and 60. Their GCF is 12 and their LCM is 360. That means 12 is the biggest number that divides all three evenly (24 ÷ 12 = 2, 36 ÷ 12 = 3, 60 ÷ 12 = 5), and 360 is the first number that all three divide into (360 ÷ 24 = 15, 360 ÷ 36 = 10, 360 ÷ 60 = 6). The common factors are the factors of 12: 1, 2, 3, 4, 6 and 12.

What the GCF and LCM are used for

Common mistakes

Working with fractions or averages next? Try the Fraction Calculator, the Average Calculator or the Quadratic Formula Calculator.

Frequently asked questions

Are GCF, GCD and HCF the same thing?

Yes. Greatest common factor (GCF), greatest common divisor (GCD) and highest common factor (HCF) are three names for the same value: the largest whole number that divides all of the given numbers with no remainder. GCF is common in US classrooms, GCD in number theory and programming, and HCF in the UK, India and many other countries.

How do you find the GCF of two numbers?

The quickest method for large numbers is the Euclidean algorithm. Divide the larger number by the smaller one, keep the remainder, then divide the smaller number by that remainder, and repeat until the remainder is 0. The last nonzero remainder is the GCF. For 48 and 18 the steps are 48 = 2 x 18 + 12, 18 = 1 x 12 + 6, 12 = 2 x 6 + 0, so the GCF is 6.

What is the relationship between GCF and LCM?

For exactly two numbers, GCF times LCM equals the product of the two numbers. For 12 and 18 the GCF is 6 and the LCM is 36, and 6 x 36 = 216 = 12 x 18. This lets you get the LCM from the GCF: LCM = (a x b) / GCF. The identity does not hold for three or more numbers.

What is the GCF of two numbers with no common factors?

It is 1. Numbers whose only shared factor is 1 are called coprime or relatively prime, such as 8 and 15. Their LCM equals their product, 120. A fraction made from coprime numbers, like 8/15, is already in lowest terms.

How do I use the GCF to simplify a fraction?

Find the GCF of the numerator and the denominator, then divide both by it. For 42/56 the GCF is 14, so 42 / 14 = 3 and 56 / 14 = 4, giving 3/4. Enter the two numbers in the calculator and it shows the simplified fraction for you.

How large can the numbers be?

The GCF, the LCM and the Euclidean steps work for whole numbers up to 18 digits each. Prime factorization is shown for numbers up to 1,000,000,000,000 (one trillion), because factoring bigger numbers by trial division in a browser can be slow. Above that limit you still get the GCF and LCM.