CCalculate.Studio

🔗 GCF and LCM Calculator

The greatest common factor (GCF, also called the greatest common divisor) is the largest whole number that divides every number in a list evenly, and the least common multiple (LCM) is the smallest whole number that every number in the list divides into evenly. This calculator finds both for two or more whole numbers using the Euclidean algorithm.

Ultima revisione: 2026-07-07

Understanding GCF and LCM together

GCF and LCM sit at opposite ends of a related pair of questions: GCF finds the largest shared factor, while LCM finds the smallest shared multiple.

NumbersGCFLCMTypical use
12, 18, 24672Simplifying the fraction 12/18 to 2/3; finding a common denominator
4, 6212Finding when two repeating cycles of length 4 and 6 next align
7, 131 (coprime)91Numbers with no shared factor besides 1 have LCM equal to their product
  • When two numbers share no common factor other than 1, they are called coprime (or relatively prime); their GCF is 1 and their LCM equals the product of the two numbers.
  • GCF is used to reduce a fraction to lowest terms by dividing both the numerator and denominator by their GCF. LCM is used to find the least common denominator when adding or subtracting fractions with different denominators.
  • This calculator treats all entered numbers as positive whole numbers; decimal or negative inputs are converted to their absolute, rounded whole-number equivalents before computing.

What are GCF and LCM?

The greatest common factor (GCF) of a set of whole numbers is the largest whole number that divides each of them without leaving a remainder. For example, the GCF of 12, 18 and 24 is 6, because 6 divides all three numbers evenly (12÷6=2, 18÷6=3, 24÷6=4) and no larger number does. GCF is also commonly called the greatest common divisor (GCD).

The least common multiple (LCM) of a set of whole numbers is the smallest positive whole number that each of them divides into evenly. The LCM of 12, 18 and 24 is 72, because 72 is the smallest number that is a multiple of all three (72÷12=6, 72÷18=4, 72÷24=3).

GCF and LCM are widely used together: GCF simplifies fractions to lowest terms and finds the largest equal-sized groups possible from different quantities, while LCM finds a common denominator for adding or comparing fractions and determines when repeating events (such as two differently-timed cycles) will next coincide.

How to use this GCF and LCM calculator

  1. Enter two or more positive whole numbers, separated by commas (e.g. 12, 18, 24).
  2. The calculator finds the GCF using the Euclidean algorithm, applied pairwise across all the numbers you entered.
  3. The LCM is computed from the GCF using the identity LCM(a, b) = (a × b) ÷ GCF(a, b), extended pairwise across the full list.
  4. Read the GCF, the LCM, and — when the GCF is 2 or greater — its prime factorization.

The Euclidean algorithm and the GCF–LCM relationship

Euclidean algorithm: GCF(a, b) = GCF(b, a mod b), until b = 0
LCM(a, b) = (a × b) ÷ GCF(a, b)
Example: GCF(12, 18, 24) = 6; LCM(12, 18, 24) = 72

The GCF is computed using the Euclidean algorithm, one of the oldest algorithms in mathematics (described in Euclid's Elements, Book VII, around 300 BCE). It repeatedly replaces the larger of two numbers with the remainder of dividing the larger by the smaller, until the remainder is 0 — the last nonzero value is the GCF. Worked example: GCF(12, 18): 18 = 1×12 + 6, then 12 = 2×6 + 0, so GCF(12, 18) = 6. Then GCF(6, 24): 24 = 4×6 + 0, so GCF(6, 24) = 6, giving GCF(12, 18, 24) = 6.

For more than two numbers, the GCF is found by applying the two-number algorithm repeatedly: GCF(a, b, c) = GCF(GCF(a, b), c).

The LCM of two numbers relates directly to their GCF through the identity LCM(a, b) = (a × b) ÷ GCF(a, b) — this works because the product of two numbers always equals the product of their GCF and LCM. Worked example: LCM(12, 18) = (12 × 18) ÷ GCF(12, 18) = 216 ÷ 6 = 36. Extending to a third number: LCM(36, 24) = (36 × 24) ÷ GCF(36, 24) = 864 ÷ 12 = 72, giving LCM(12, 18, 24) = 72.

Common mistakes

  • Confusing GCF with LCM — GCF is always less than or equal to the smallest number entered, while LCM is always greater than or equal to the largest number entered.
  • Assuming LCM(a, b) = a × b always — this shortcut is only true when a and b are coprime (GCF = 1); otherwise LCM(a, b) = (a × b) ÷ GCF(a, b).
  • Trying to find GCF or LCM with only one number — both concepts require comparing at least two numbers, since a single number's 'GCF' and 'LCM' with itself are trivially just that number.
  • Forgetting that GCF and LCM are defined for positive whole numbers, not fractions or decimals — non-integer inputs must be interpreted or converted before applying these formulas.

Domande frequenti

How do you find the greatest common factor (GCF) of numbers?

The most efficient method is the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller number, until the remainder reaches 0 — the last nonzero remainder is the GCF. For 12 and 18: 18 mod 12 = 6, then 12 mod 6 = 0, so GCF(12, 18) = 6.

How do you find the least common multiple (LCM) of numbers?

First find the GCF, then apply LCM(a, b) = (a × b) ÷ GCF(a, b). For 12 and 18: GCF = 6, so LCM = (12 × 18) ÷ 6 = 216 ÷ 6 = 36. For more than two numbers, apply the formula pairwise, combining the running LCM with each new number.

What is the relationship between GCF and LCM?

For any two positive whole numbers a and b, the product of their GCF and LCM always equals the product of the numbers themselves: GCF(a, b) × LCM(a, b) = a × b. This identity is what allows the LCM to be computed quickly once the GCF is known, without listing out multiples.

What does it mean for two numbers to be coprime?

Two numbers are coprime (or relatively prime) if their only common positive factor is 1 — their GCF is 1. Coprime numbers need not be prime themselves; for example, 8 and 9 are coprime (GCF = 1) even though neither is a prime number. When two numbers are coprime, their LCM equals their product.

How is GCF used to simplify fractions?

Divide both the numerator and the denominator of a fraction by their GCF to reduce it to lowest terms. For 12/18, the GCF of 12 and 18 is 6, so 12/18 = (12÷6)/(18÷6) = 2/3, which cannot be simplified further since GCF(2, 3) = 1.

Fonti

  1. Euclid. Elements, Book VII, Propositions 1–2 (the Euclidean algorithm), c. 300 BCE. Translated edition: Heath TL. Euclid's Elements. Dover, 1956.
  2. Rosen KH. Elementary Number Theory and Its Applications. 6th ed. Pearson, 2010. (GCD, LCM and the Euclidean algorithm.)
  3. NIST Digital Library of Mathematical Functions (DLMF), §27.1 Number Theory: Multiplicative Number Theory. dlmf.nist.gov.

Teoria dei numeri · Tutti i calcolatori

Calcolatori correlati