Free calculators with the working shown
CalcTools

Free maths & study calculator

GCF and LCM Calculator

Find the greatest common factor (also called GCD or HCF) and the least common multiple of up to 20 whole numbers, with prime factorisation and step-by-step Euclidean algorithm.

Start calculating →How it works ↓

  • 100% free
  • Instant results
  • No sign-up, private
GCF and LCM Calculator

Free · No sign-up · Calculated in your browser

GCF and LCM in one sentence each

The greatest common factor (GCF) of a set of whole numbers is the largest number that divides all of them exactly. It is also called the greatest common divisor (GCD) or highest common factor (HCF); the three names mean the same thing. The least common multiple (LCM) is the smallest positive number that all of them divide into exactly. For 12, 18 and 30 the GCF is 6 and the LCM is 180.

Method 1: prime factorisation

Break each number into prime factors, then compare the powers of each prime:

  • 12 = 2² × 3
  • 18 = 2 × 3²
  • 30 = 2 × 3 × 5

For the GCF, take each prime that appears in every number, using its lowest power: 2¹ × 3¹ = 6. The prime 5 is left out because it does not divide 12 or 18.

For the LCM, take every prime that appears in any number, using its highest power: 2² × 3² × 5 = 4 × 9 × 5 = 180.

Method 2: the Euclidean algorithm

For big numbers, factorising is slow. Euclid's algorithm, more than 2,000 years old, finds the GCF of two numbers by repeated division: divide the larger by the smaller, replace the larger with the remainder, and repeat until the remainder is zero. The last non-zero remainder is the GCF.

StepDivisionRemainder
1126 = 1 × 84 + 4242
284 = 2 × 42 + 00

So GCF(84, 126) = 42. Once you have the GCF of two numbers, the LCM follows from a neat identity:

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

LCM(84, 126) = 84 × 126 ÷ 42 = 10,584 ÷ 42 = 252. For three or more numbers, apply the rule step by step: GCF(a, b, c) = GCF(GCF(a, b), c), and the same for the LCM. The calculator shows the Euclidean steps for the first two numbers you enter.

More worked examples

NumbersGCFLCM
48 and 18012720
8, 12 and 204120
1 to 1012,520
7 and 13 (both prime)191

When the GCF is 1, the numbers are called coprime (or relatively prime), and their LCM is simply their product. Note that 2,520 is the smallest number divisible by every whole number from 1 to 10.

Where you actually use them

  • Simplifying fractions: divide the top and bottom by their GCF. 84/126 ÷ 42 = 2/3. The fraction calculator does this automatically.
  • Adding fractions: the lowest common denominator is the LCM of the denominators. For 1/8 + 1/12, the LCM of 8 and 12 is 24, so 1/8 + 1/12 = 3/24 + 2/24 = 5/24.
  • Simplifying ratios: 1920 : 1080 ÷ GCF 120 = 16 : 9 (see the ratio calculator).
  • Scheduling: if one bus leaves every 12 minutes and another every 18, they leave together every LCM(12, 18) = 36 minutes.
  • Cutting and tiling: the largest square tile that exactly covers a 240 cm × 180 cm floor without cutting has a side of GCF(240, 180) = 60 cm, giving 4 × 3 = 12 tiles.
  • Gears and cycles: two meshing gears with 12 and 18 teeth return to the same starting position after LCM(12, 18) = 36 teeth have passed, which is 3 turns of the small gear and 2 of the large one.

Common mistakes

  • Mixing up the two. The GCF is never larger than the smallest number; the LCM is never smaller than the largest. If your answer breaks this rule, you have swapped them.
  • Using highest powers for the GCF. GCF takes the lowest power of shared primes; LCM takes the highest power of all primes.
  • Multiplying to get the LCM of three numbers. a × b × c is a common multiple, but usually not the least one: 12 × 18 × 30 = 6,480, while the LCM is 180.
  • Including zero or decimals. GCF and LCM are defined for positive whole numbers. Scale decimals to whole numbers first (1.2 and 1.8 → 12 and 18).

Frequently asked questions

What is the GCF of 12, 18 and 30?

6. Their prime factorisations are 2²×3, 2×3² and 2×3×5; the shared primes with lowest powers are 2 and 3, and 2 × 3 = 6.

Is GCD the same as GCF and HCF?

Yes. Greatest common divisor, greatest common factor and highest common factor are three names for the same number.

How do I find the LCM from the GCF?

Multiply the two numbers and divide by their GCF. For 84 and 126: 84 × 126 ÷ 42 = 252.

What is the LCM of 1 to 10?

2,520 — the smallest number that every whole number from 1 to 10 divides exactly.

Sources

  • Euclid, Elements, Book VII, Propositions 1–2 (the Euclidean algorithm).
  • Hardy GH, Wright EM. An Introduction to the Theory of Numbers, 6th ed., Oxford University Press, 2008 (Chapter 2, the fundamental theorem of arithmetic).

Last reviewed 14 October 2026. Results are estimates; see our disclaimer.

Related calculators