Math

GCF and LCM Calculator

Enter two or more whole numbers to find the greatest common factor and least common multiple, with full prime factorization steps.

0 values

Formulas

GCF(a, b)

Reduce repeatedly until remainder is 0

GCF (multiple)

Reduce the list pairwise, left to right

LCM(a, b)

Smallest number divisible by both a and b

LCM (multiple)

Reduce the list pairwise, left to right

Prime method GCF

e.g. 12=2²×3, 18=2×3² → GCF=2×3=6

Prime method LCM

e.g. 12=2²×3, 18=2×3² → LCM=2²×3²=36

GCF vs LCM

GCF (Greatest Common Factor)

The largest number that divides evenly into every value in the set. Always ≤ the smallest input. Used to simplify fractions and reduce ratios.

LCM (Least Common Multiple)

The smallest number that every value in the set divides into evenly. Always ≥ the largest input. Used to find common denominators and align repeating cycles.

Handy identity: for two numbers, GCF(a,b) × LCM(a,b) = a × b.

Tips

Simplifying fractions: Divide both numerator and denominator by their GCF to reduce a fraction to lowest terms.

Common denominators: Use the LCM of the denominators as the smallest common denominator when adding or subtracting fractions.

Coprime numbers: If the GCF of two numbers is 1, they share no common prime factors and are called coprime — in that case the LCM equals their product.

FAQ

Frequently asked questions.

What is GCF (greatest common factor)?

The greatest common factor (GCF), also called the greatest common divisor (GCD), is the largest positive integer that divides evenly into every number in a set. For example, the GCF of 12 and 18 is 6, because 6 is the largest number that divides both 12 and 18 without a remainder. GCF is most useful for simplifying fractions and factoring expressions.

What is LCM (least common multiple)?

The least common multiple (LCM) is the smallest positive integer that is a multiple of every number in a set. For example, the LCM of 12 and 18 is 36, because 36 is the smallest number that both 12 and 18 divide into evenly. LCM is most useful for finding a common denominator when adding or subtracting fractions, and for scheduling problems involving repeating cycles.

What is the difference between GCF and LCM?

GCF is the largest number that divides into a set of numbers, while LCM is the smallest number that a set of numbers divides into. GCF is always less than or equal to the smallest input number, while LCM is always greater than or equal to the largest input number. In practice, GCF shrinks a fraction to its simplest form, while LCM grows fractions to a shared denominator.

How do you find the GCF using prime factorization?

First, break each number down into its prime factors — for example, 12 = 2² × 3 and 18 = 2 × 3². Next, identify the prime factors that appear in every number, and for each shared prime, take the lowest power it appears with across all the numbers. Multiply those together: for 12 and 18, both share 2¹ and 3¹, so the GCF is 2 × 3 = 6.

How do you find the LCM using prime factorization?

First, break each number down into its prime factors — for example, 12 = 2² × 3 and 18 = 2 × 3². Next, take every prime that appears in any of the numbers, using the highest power it appears with in any single number. Multiply those together: for 12 and 18, the highest power of 2 is 2² (from 12) and the highest power of 3 is 3² (from 18), so the LCM is 4 × 9 = 36.

When do you use GCF versus LCM in real life?

GCF is used to simplify fractions to lowest terms, divide items into equal groups with nothing left over, and reduce ratios. LCM is used to find a common denominator when adding or subtracting fractions, and to solve scheduling problems such as figuring out when two repeating events — like buses arriving every 12 minutes and 18 minutes — will next align.

Can this calculator find the GCF and LCM of more than two numbers?

Yes. This calculator accepts any list of two or more positive integers. It computes the GCF and LCM across the entire list by reducing pairwise: the GCF of the whole set is the GCF of the running result and the next number, and the same reduction applies to the LCM, using the identity LCM(a, b) = (a × b) / GCD(a, b).

Last updated: August 17, 2026