GCD & LCM Calculator
What Is GCD (Greatest Common Divisor)?
The Greatest Common Divisor (GCD), also called the Highest Common Factor (HCF) or Greatest Common Factor (GCF), is the largest positive integer that divides two or more numbers without a remainder.
Example: GCD(12, 18) = 6, because 6 is the largest number that divides both 12 and 18 evenly.
What Is LCM (Least Common Multiple)?
The Least Common Multiple (LCM) is the smallest positive integer that is divisible by all the given numbers.
Example: LCM(4, 6) = 12, because 12 is the smallest number that both 4 and 6 divide into evenly.
How GCD and LCM Are Related
For two numbers a and b: GCD(a,b) × LCM(a,b) = a × b
This is a useful relationship — if you know the GCD, you can calculate the LCM without prime factorization: LCM = (a × b) ÷ GCD
The Euclidean Algorithm (for GCD)
The Euclidean algorithm is an efficient method for computing GCD: repeatedly divide the larger number by the smaller, replacing the larger with the remainder, until the remainder is zero. The last non-zero remainder is the GCD.
GCD(48, 18): 48 = 2×18 + 12 → 18 = 1×12 + 6 → 12 = 2×6 + 0 → GCD = 6
Real-World Applications
- Simplifying fractions: Divide both numerator and denominator by their GCD. 18/24 → divide by GCD(18,24)=6 → 3/4
- LCM for adding fractions: To add 1/4 + 1/6, find LCM(4,6)=12, convert to 3/12 + 2/12 = 5/12
- Scheduling: Two events repeat every 4 and 6 days — they next coincide in LCM(4,6)=12 days
- Gear ratios and tiling: Finding smallest common dimensions or patterns
How to Use
- 1Enter your numbersType 2–10 positive integers, separated by commas or spaces.
- 2Click CalculateThe GCD and LCM are calculated instantly using the Euclidean algorithm and prime factorization.
- 3Review the stepsExpand the "Step-by-Step" section to see the prime factorization working for each number.