GCF and LCM Calculator

Find the greatest common factor and least common multiple of two or more whole numbers.

  • Reviewed October 2026
  • Formula and worked example below
  • Free, no sign-up, runs in your browser
Enter your numbers to see the result.

Greatest common factor (GCF)

The GCF, also called the greatest common divisor (GCD) or highest common factor (HCF), is the largest number that divides all your numbers exactly. It is used to simplify fractions and ratios.

Euclid's algorithm

Divide the larger number by the smaller and keep the remainder. Replace the larger number with the smaller and the smaller with the remainder. Repeat until the remainder is zero; the last non-zero divisor is the GCF.

GCF(36, 24): 36 ÷ 24 = 1 remainder 12. 24 ÷ 12 = 2 remainder 0. So the GCF is 12. Then GCF(12, 60) = 12, so the GCF of 24, 36 and 60 is 12.

Least common multiple (LCM)

The LCM is the smallest number that all your numbers divide into exactly. It is the lowest common denominator when adding fractions.

LCM(a, b) = a × b ÷ GCF(a, b)

LCM(24, 36) = 864 ÷ 12 = 72. LCM(72, 60) = 4,320 ÷ 12 = 360.

Using prime factorization

Write each number as a product of primes: 24 = 2³ × 3, 36 = 2² × 3², 60 = 2² × 3 × 5. The GCF takes the lowest power of each shared prime (2² × 3 = 12). The LCM takes the highest power of every prime (2³ × 3² × 5 = 360).

Frequently asked questions

What is the difference between GCF and LCM?

The GCF is the largest number that divides all the numbers. The LCM is the smallest number that all of them divide into.

What is the GCF of two prime numbers?

It is 1, because prime numbers share no factors other than 1. Their LCM is their product.

Where is the LCM used in real life?

Scheduling repeating events: if one bus comes every 12 minutes and another every 18, they arrive together every LCM(12, 18) = 36 minutes.

Add this calculator to your website

Free to use on blogs, school sites and company intranets. Copy this code into your page:

Last reviewed Oct 20, 2026. Results are estimates; check important decisions with a qualified professional.