LCM and GCF Calculator
Find the Least Common Multiple (LCM) and Greatest Common Factor (GCF) of two or more whole numbers. Enter numbers separated by commas or spaces and see the step-by-step solution.
Least Common Multiple
LCM
Greatest Common Factor
GCF / GCD
Prime Factorizations
Step-by-Step Solution
What Is the Greatest Common Factor (GCF)?
The Greatest Common Factor (also called GCD — Greatest Common Divisor) is the largest positive integer that divides each of the given numbers without a remainder. For example, the GCF of 12 and 18 is 6 because 6 is the largest number that divides both evenly (12 ÷ 6 = 2; 18 ÷ 6 = 3).
The GCF is useful when simplifying fractions. To reduce a fraction to its lowest terms, divide both the numerator and denominator by their GCF. For example, to simplify 12/18: GCF(12,18) = 6, so 12/18 = 2/3. You can also use the fraction calculator to perform arithmetic on fractions automatically.
What Is the Least Common Multiple (LCM)?
The Least Common Multiple is the smallest positive integer that is a multiple of each of the given numbers. For example, the LCM of 4 and 6 is 12 because 12 is the smallest number divisible by both 4 (12 ÷ 4 = 3) and 6 (12 ÷ 6 = 2).
The LCM is essential when adding or subtracting fractions with different denominators. To add ¼ + ⅙, you need the LCM of 4 and 6 (which is 12) as the common denominator: 3/12 + 2/12 = 5/12.
How to Find LCM and GCF Using Prime Factorization
Step 1 — Prime Factorization
Break each number into its prime factors. For example: 12 = 2² × 3, and 18 = 2 × 3².
Step 2 — GCF: Take the Lowest Power of Each Common Prime
For GCF, identify each prime factor that appears in ALL numbers. Take the lowest exponent for each. For 12 = 2² × 3 and 18 = 2 × 3²: common primes are 2 (min power = 1) and 3 (min power = 1). GCF = 2¹ × 3¹ = 6.
Step 3 — LCM: Take the Highest Power of Each Prime
For LCM, identify every prime factor that appears in ANY number. Take the highest exponent for each. For 12 = 2² × 3 and 18 = 2 × 3²: all primes are 2 (max power = 2) and 3 (max power = 2). LCM = 2² × 3² = 4 × 9 = 36.
GCF and LCM Relationship
For any two positive integers a and b: LCM(a, b) × GCF(a, b) = a × b. This is a handy verification check: LCM(12,18) × GCF(12,18) = 36 × 6 = 216 = 12 × 18 ✓.
Frequently Asked Questions
What is the GCF of two prime numbers?
The GCF of any two different prime numbers is always 1. For example, GCF(7, 13) = 1. This makes sense because prime numbers have no factors other than 1 and themselves, so they share no common factors.
What is the LCM of two numbers if one divides the other?
If one number is a multiple of the other, the LCM is simply the larger number. For example, LCM(4, 12) = 12, because 12 is already a multiple of 4.
What does it mean when the GCF is 1?
When the GCF of two numbers is 1, the numbers are called coprime (or relatively prime). They share no common prime factors. For example, GCF(8, 15) = 1 — they are coprime even though neither is itself prime.
Can I find the LCM and GCF of more than two numbers?
Yes — this calculator supports three or more numbers. For the GCF, apply the operation pairwise: GCF(a, b, c) = GCF(GCF(a, b), c). The same applies for LCM. The prime factorization method extends naturally to any count of numbers.
What are real-world uses of LCM?
LCM is used in scheduling (finding when repeating events coincide), music (note rhythms), adding fractions, and computing gear ratios. For example, two traffic lights cycling every 40 and 60 seconds will sync up every LCM(40, 60) = 120 seconds.