LCM & GCF Calculator

Enter two or more whole numbers to find their greatest common factor and least common multiple, with prime factorizations and the Euclidean algorithm worked out step by step.

LCM & GCF Calculator

Two to ten whole numbers, separated by commas or spaces. Numbers of any size work.
Try:

Example Numbers: 48, 180

Greatest common factor (GCF)
12
Least common multiple (LCM)
720

12 is the largest number that divides both; 720 is the smallest positive number they all divide into.

Method 1: prime factorization

Prime factorization of each number, with the exponent of each prime
NumberFactorizationExponent of 2Exponent of 3Exponent of 5
4824 × 3410
18022 × 32 × 5221
GCF22 × 3 = 12210
LCM24 × 32 × 5 = 720421

Columns 2, 3, 5 give the exponent of each prime. The GCF row takes the lowest exponent in each column, the LCM row the highest.

  1. GCF: take only the primes that appear in every number, each with its lowest power: 22 × 3 = 12.
  2. LCM: take every prime that appears, each with its highest power: 24 × 32 × 5 = 720.

Method 2: the Euclidean algorithm (GCF)

Divide the larger number by the smaller and keep the remainder; repeat with the divisor and the remainder. When the remainder reaches 0, the last divisor is the GCF.

  1. 180 = 3 × 48 + 36
  2. 48 = 1 × 36 + 12
  3. 36 = 3 × 12 + 0

The last nonzero remainder is 12, so GCF(48, 180) = 12.

Method 3: LCM from the GCF

lcm(a, b) = |a × b| ÷ gcd(a, b)

  1. lcm(48, 180) = 48 × 180 ÷ 12 = 8,640 ÷ 12 = 720

Check: GCF × LCM = 12 × 720 = 8,640 = 48 × 180. For two numbers this is always true.

Adding or subtracting fractions? The LCM of the denominators is the least common denominator. The fraction calculator uses it automatically and shows the steps.

How to use the LCM and GCF calculator

Type two or more whole numbers separated by commas or spaces — up to ten at once, and as large as you like. Negative numbers are allowed (their signs are ignored) and so is 0. Both answers appear as you type, followed by the working three different ways, so you can match whichever method your class uses: prime factorization, the Euclidean algorithm, or the LCM-from-GCF formula. The page address keeps your numbers, so you can bookmark or share the solution.

What the GCF and LCM mean

A factor of a number divides it evenly: the factors of 12 are 1, 2, 3, 4, 6 and 12. A multiple is what you get by multiplying it by a whole number: 12, 24, 36, 48… The greatest common factor is the biggest factor the numbers share, and the least common multiple is the smallest positive multiple they share. Listing factors or multiples works for small numbers; the three methods below work for any size.

Three ways to find them

  • Prime factorization. Write each number as a product of primes. The GCF uses only the primes every number has, each with its lowest power; the LCM uses every prime that appears, each with its highest power.
  • Euclidean algorithm. Replace the larger number with the remainder of dividing it by the smaller one, and repeat. When the remainder is 0, the last divisor is the GCF.
  • LCM from the GCF. For two numbers, lcm(a, b) = |a × b| ÷ gcd(a, b). For more numbers, apply it one pair at a time.

Worked example: 48 and 180

These are the numbers the calculator shows when it loads.

  1. Factor: 48 = 24 × 3 and 180 = 22 × 32 × 5.
  2. GCF: the shared primes are 2 and 3; their lowest powers give 22 × 3 = 12.
  3. LCM: every prime with its highest power: 24 × 32 × 5 = 720.
  4. Euclid: 180 = 3 × 48 + 36, then 48 = 1 × 36 + 12, then 36 = 3 × 12 + 0. The last nonzero remainder is 12.
  5. Formula: 48 × 180 ÷ 12 = 8,640 ÷ 12 = 720.

As a check, GCF × LCM = 12 × 720 = 8,640, which equals 48 × 180. That identity holds for any two positive numbers (but not for three or more).

Where you’ll use them

  • Fractions: the LCM of the denominators is the least common denominator, and dividing top and bottom by the GCF simplifies a fraction in one step — 48/180 = 4/15. See the fraction calculator.
  • “When will they line up again?” problems: if one bus comes every 12 minutes and another every 18, they leave together again after lcm(12, 18) = 36 minutes.
  • “Largest equal groups” problems: 48 pencils and 180 erasers split into identical kits with nothing left over gives at most GCF = 12 kits, each with 4 pencils and 15 erasers.

Common mistakes

  • Mixing up the rules. GCF → shared primes, lowest powers. LCM → all primes, highest powers.
  • Multiplying instead of finding the LCM. 12 × 18 = 216 is a common multiple, but the least one is 36.
  • Using the two-number formula on three numbers at once. lcm(a, b, c) is not a × b × c ÷ gcd(a, b, c); work in pairs.
  • Missing a prime. Keep dividing until every factor is prime — 9 is 3², not a prime.

Need a quick product for the formula method? Use the online calculator, or practice times tables with the multiplication table.

Frequently asked questions

What is the difference between the GCF and the LCM?

The greatest common factor is the largest number that divides into all of your numbers, so it is never bigger than the smallest one. The least common multiple is the smallest positive number that all of your numbers divide into, so it is never smaller than the largest one. For 48 and 180 the GCF is 12 and the LCM is 720.

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 number. GCF is the usual term in US schools; GCD is common in higher math and programming.

How do I find the LCM or GCF of three or more numbers?

Work in pairs. Find the answer for the first two numbers, then combine that result with the third number, and so on: GCF(12, 18, 30) = GCF(GCF(12, 18), 30) = GCF(6, 30) = 6. With prime factorization you can do all the numbers at once: lowest powers of the shared primes for the GCF, highest powers of every prime for the LCM.

What if the GCF is 1?

Then the numbers are relatively prime (coprime): they share no prime factors, even if neither is prime itself, like 35 and 64. For two coprime numbers the LCM is just their product, 35 × 64 = 2,240.

How are the LCM and GCF used with fractions?

The LCM of the denominators is the least common denominator you need to add or subtract fractions: 1/48 + 1/180 uses 720. The GCF simplifies a fraction in one step: 48/180 ÷ 12/12 = 4/15. The fraction calculator does both and shows the working.

Which method is fastest for large numbers?

The Euclidean algorithm. It only needs repeated division with remainder, so it stays quick even for numbers with dozens of digits, whereas factoring large numbers can be very slow. This calculator always computes the GCF and LCM with the Euclidean algorithm and shows the prime factorizations alongside.

Last reviewed · Built and checked by the Reeliy team · How we test our tools