Number theory · Visual learning

GCF & LCM calculator

Learn why greatest common factor and least common multiple work — then watch the factor structure, prime exponents, multiples, and Euclidean algorithm update live.

Report error
GCF
6
greatest common factor
LCM
36
least common multiple
LCM ÷ GCF
6
scale between the two
Live factor structure · what GCF shares
Each input is redrawn as GCF × quotient. The common factor is the part every number can share.
LIVE
Shared factor 6Every input is GCF × an integer
Live prime-exponent map · why LCM uses the maximum
For every prime, the GCF keeps the smallest exponent while the LCM keeps the largest exponent.
LIVE
GCF uses minimum exponentsLCM uses maximum exponents
Live multiples timeline · where the LCM appears
The first shared multiple of the first two inputs is highlighted. This makes the definition of LCM visible rather than memorized.
LIVE
First common multiple 36Smallest positive common multiple
Live Euclidean algorithm · GCF by repeated remainders
For the first two inputs, each division replaces the pair with the divisor and remainder until the remainder becomes zero.
LIVE
Last non-zero remainder 6That remainder is the GCF
Live intelligence

What the current numbers are telling you

LIVE
Inputs12 · 18 · 30
GCF6
LCM180
RelationshipG×L = product
GCF removes what is not shared; LCM gathers every prime power required by at least one input.

Multiples until the LCM

—
k12 × k18 × k
GCF is the largest positive integer that divides every input. LCM is the smallest positive integer divisible by every input.

Prime factorization

Structure
NumberPrime factors
Prime method: choose minimum exponents for GCF and maximum exponents for LCM.

Whole numbers

Enter 2–6 non-zero whole numbers. Empty boxes are ignored.

Number theory · Visual learning

Understanding GCF and LCM

Greatest common factor (GCF), also called greatest common divisor (GCD), and least common multiple (LCM) are two complementary ways of reading the same prime-factor structure. GCF asks, “What can all the numbers share?” LCM asks, “What must a common multiple contain?”

The central idea: when integers are written as prime powers, GCF takes the smallest exponent shared by every input, while LCM takes the largest exponent appearing anywhere.

1. The two core rules

Greatest common factor
GCF = ∏ pminimum exponent
Keep only primes present in every input, using the smallest exponent.
Least common multiple
LCM = ∏ pmaximum exponent
Keep every prime that appears, using its largest exponent.

This is why the two answers can be obtained from the same factorization. GCF is a shared structure; LCM is a complete requirement list.

2. Prime factors turn the rule into a picture

Take 12, 18, and 30. Their prime factorizations are 12 = 2² × 3, 18 = 2 × 3², and 30 = 2 × 3 × 5. The prime 2 is present in all three, but only one copy is guaranteed in every number. The same is true for 3. Therefore GCF = 2 × 3 = 6. For the LCM, keep the strongest requirement: 2², 3², and 5, giving 180.

One factorization, two answers
12=2²3
18=23²
30=235
GCF→23= 6
LCM→2²3²5= 180

3. The most important distinction

QuestionGCFLCM
What are we looking for?Largest common divisorSmallest common multiple
Prime-exponent ruleSmallest exponentLargest exponent
DirectionWhat can all numbers share?What must a common multiple contain?
Typical useSimplifying, grouping, factoringCommon denominators, repeating cycles

A useful mental model is: GCF is compression; LCM is completion. GCF removes factors that are not guaranteed to be shared. LCM gathers enough prime powers to satisfy every divisibility requirement.

4. Worked example: 12, 18, and 30

Example 01 · Prime-factor method

Step 1. 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5.

Step 2. GCF uses minimum exponents: 2¹ × 3¹ = 6.

Step 3. LCM uses maximum exponents: 2² × 3² × 5 = 180.

Step 4. Check: 6 divides 12, 18, and 30; 180 is divisible by all three.

GCF = 6 · LCM = 180

5. Three reliable methods

Prime factorizationBest for understanding structure and for several inputs. Minimum exponents give GCF; maximum exponents give LCM.
Euclidean algorithmEspecially efficient for the GCF of two integers. Repeatedly replace the pair with the divisor and the remainder.
Listing multiplesVery intuitive for small LCM problems. Write multiples until the first shared value appears.
Ladder / division methodDivide by useful primes while carrying down numbers that are not divisible. The left-side factors build the LCM.

6. The Euclidean algorithm: GCF through remainders

The Euclidean algorithm rests on a powerful observation: the common divisors of a and b are exactly the common divisors of b and the remainder when a is divided by b.

Example 02 · GCF(252, 105)

252 = 2 × 105 + 42

105 = 2 × 42 + 21

42 = 2 × 21 + 0

The last non-zero remainder is 21, so GCF(252, 105) = 21.

7. LCM and common denominators

LCM is one of the most useful ideas behind fraction addition. If denominators are different, they must be rewritten using a common denominator. The least common multiple gives the smallest common denominator that works for both.

Example 03 · Unlike denominators

LCM(4, 6) = 12

1/4 = 3/12    and    1/6 = 2/12

1/4 + 1/6 = 3/12 + 2/12 = 5/12

8. GCF and simplifying fractions

GCF identifies the largest factor that can divide both numerator and denominator without changing the fraction's value.

Example 04 · Simplifying 24/36

GCF(24, 36) = 12

24 ÷ 12 = 2    and    36 ÷ 12 = 3

24/36 = 2/3

9. Coprime numbers and edge cases

Two integers are coprime when their GCF is 1. They do not need to be prime: 8 and 15 are coprime even though both are composite. For positive coprime integers a and b, LCM(a,b) = a × b.

CaseGCFLCMMeaning
8 and 151120Coprime
12 and 18636Shared factors
12 and 361236One divides the other
1 and 251251 adds no new factor

For two nonzero integers a and b, the identity GCF(a,b) × LCM(a,b) = |ab| provides an excellent independent check. With three or more numbers, use prime exponents or combine the two-number identity pairwise rather than applying it blindly to the whole set.

10. A compact method worth remembering

  1. Factor the numbers when you want the clearest structural picture.
  2. For GCF, go downward. Keep only primes every input contains, using the smallest exponent.
  3. For LCM, go upward. Keep every prime that appears, using the largest exponent.
  4. Check the result. GCF must divide every input; LCM must be divisible by every input.

11. Units, signs, and valid inputs

GCF and LCM are normally taught for integers. This calculator therefore expects non-zero whole numbers. For negative integers, the factor structure is handled through absolute values. Zero needs special treatment: GCF(a, 0) is |a| for nonzero a, while conventions for an LCM involving zero vary. Keeping the calculator focused on non-zero whole numbers avoids hiding that distinction.

12. Frequently asked questions

Is GCF the same as GCD?

Yes. Greatest Common Factor and Greatest Common Divisor describe the same quantity. GCD is especially common in higher mathematics and computer science.

What is the difference between a factor and a multiple?

A factor divides a number exactly. A multiple is produced by multiplying a number by an integer. GCF searches among shared factors; LCM searches among shared multiples.

Can GCF be larger than the smallest positive input?

No. Every common factor divides the smallest positive input, so GCF cannot exceed it.

Can LCM be smaller than the largest positive input?

No. Every input divides the LCM, so the LCM is at least as large as the largest input.

Why does LCM use the largest prime exponent?

Because the common multiple must contain enough copies of each prime to be divisible by every input. The largest exponent is the strongest requirement that must be met.

Which hand method should I use?

For small numbers, listing factors or multiples is intuitive. For several numbers, prime factorization is systematic. For the GCF of two larger integers, the Euclidean algorithm is often the cleanest route.