GCD & LCM Calculator
Calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of up to 6 numbers instantly, with Euclidean algorithm steps and prime factorisation.
This free GCD and LCM calculator finds the greatest common divisor and least common multiple of up to six numbers at once, with step-by-step working. Use it as a GCD calculator, an LCM calculator, or both together — enter your numbers and the results, the Euclidean steps and the prime factorisation appear instantly. Below we explain what GCD and LCM are, how to find each by hand, and where they are used — so whether you need a quick answer or want to understand the method, everything is in one place.
What Is GCD (Greatest Common Divisor)?
The GCD (Greatest Common Divisor) — also called HCF (Highest Common Factor) — is the largest positive integer that divides two or more numbers without leaving a remainder. Example: the divisors of 12 are 1, 2, 3, 4, 6, 12; divisors of 18 are 1, 2, 3, 6, 9, 18. The largest divisor shared by both is 6, so GCD(12, 18) = 6.
The GCD is always at least 1. The GCD of two prime numbers is always 1. If one number is a multiple of the other, their GCD is the smaller number.
What Is LCM (Least Common Multiple)?
The LCM (Least Common Multiple) is the smallest positive integer that is a multiple of two or more numbers. Example: multiples of 4 are 4, 8, 12, 16…; multiples of 6 are 6, 12, 18, 24…. The smallest multiple shared by both is 12, so LCM(4, 6) = 12.
The LCM is always at least as large as the greatest of the input numbers. The identity GCD × LCM = a × b always holds for two numbers.
How to Find the GCD
- Euclidean Algorithm: Apply a = b × q + r until r = 0; the last non-zero divisor is the GCD. Example: GCD(48, 18) → 48 = 18×2+12 → 18 = 12×1+6 → 12 = 6×2+0. GCD = 6.
- Prime Factorisation: Factorise each number; take the common primes at their lowest powers and multiply. 48 = 2⁴×3, 18 = 2×3² → common: 2¹×3¹ = 6.
How to Find the LCM
- Formula: LCM(a, b) = (a × b) ÷ GCD(a, b).
- Prime Factorisation: Take all prime factors (common and non-common) at their highest powers and multiply. Example: 4 = 2², 6 = 2×3 → LCM = 2²×3 = 12.
GCD and LCM Relationship Table
| Numbers | GCD | LCM | GCD × LCM | a × b |
|---|---|---|---|---|
| 12 and 18 | 6 | 36 | 6×36=216 | 12×18=216 |
| 4 and 6 | 2 | 12 | 2×12=24 | 4×6=24 |
| 8 and 12 | 4 | 24 | 4×24=96 | 8×12=96 |
| 5 and 7 | 1 | 35 | 1×35=35 | 5×7=35 |
| 15 and 25 | 5 | 75 | 5×75=375 | 15×25=375 |
When to Use GCD and When to Use LCM
So what are GCD and LCM good for in practice? In short, the GCD answers questions about splitting or sharing equally, while the LCM answers questions about cycles meeting or combining. The quick guide below shows which one to reach for:
- GCD — equal-group division: "36 apples and 48 oranges — what is the largest equal group you can form?" → GCD(36, 48) = 12.
- LCM — earliest meeting / repeating cycle: "Vitamin A every 4 days, vitamin B every 6 days — how many days until both are taken on the same day?" → LCM(4, 6) = 12.
- Fraction simplification: 12/18 → divide by GCD(12,18)=6 → 2/3.
- Common denominator: 1/4 + 1/6 → common denominator = LCM(4,6) = 12 → 3/12 + 2/12 = 5/12.
- Tiling problems: Find the largest square tile that fits a floor exactly → GCD of the two dimensions.
- Scheduling / synchronisation: When two cyclic events next coincide → LCM of their periods.
How the Euclidean Algorithm Works
The Euclidean Algorithm dates to around 300 BC and is one of the oldest algorithms in existence. Its principle: the GCD of two numbers does not change if the larger is replaced by its remainder when divided by the smaller. Example — GCD(252, 105):
- 252 = 105 × 2 + 42
- 105 = 42 × 2 + 21
- 42 = 21 × 2 + 0 → remainder is 0, GCD = 21
The step-by-step display in this tool lets you follow each stage visually — useful for students and anyone who wants to understand the method, not just the result.
Worked GCD and LCM Problems
Practising with real GCD and LCM problems is the fastest way to master the topic. Here are three worked examples you can verify with the calculator above:
- Simplifying a fraction: to reduce 24/36, find GCD(24, 36) = 12, then divide both parts: 24/36 = 2/3.
- Synchronising events (LCM): two buses leave every 12 and 18 minutes. They depart together again after LCM(12, 18) = 36 minutes.
- Sharing into equal groups (GCD): to split 48 pens and 36 notebooks into identical kits with nothing left over, GCD(48, 36) = 12 gives 12 kits.
For two numbers, a quick check is the identity GCD × LCM = a × b: for 12 and 18, 6 × 36 = 216 = 12 × 18. The calculator handles two to six numbers, so you can extend these problems to larger sets too.
Where GCD and LCM Are Used in Real Life
Beyond the classroom, the greatest common divisor and least common multiple appear in many practical settings:
- Fractions: the GCD reduces fractions to lowest terms, and the LCM finds a common denominator for adding or comparing them.
- Scheduling: the LCM tells you when repeating cycles (shifts, traffic lights, maintenance intervals) line up again.
- Packaging and tiling: the GCD finds the largest equal group or the biggest square tile that fits a given area without cutting.
- Gears and music: ratios built on the GCD and LCM describe gear teeth alignment and rhythmic patterns.
Whatever your task, enter the numbers above to get the GCD, the LCM, the Euclidean steps and the prime factorisation in one place. See the frequently asked questions below for more examples.
Frequently Asked Questions About the GCD & LCM Calculator
The GCD is the largest positive integer that divides two or more numbers without leaving a remainder. Also called HCF. Example: GCD(12, 18) = 6, because 6 is the largest number that divides both 12 and 18 exactly.
The LCM is the smallest positive integer that is a multiple of two or more numbers. Example: LCM(4, 6) = 12, because 12 is the smallest number that is a multiple of both 4 and 6.
Two methods: 1) Euclidean Algorithm — apply a = b×q+r until r = 0; the last non-zero divisor is the GCD. 2) Prime factorisation — factorise each number and take the common primes at their lowest powers.
Formula: LCM(a,b) = (a×b) ÷ GCD(a,b). Prime factorisation: take all prime factors (common and non-common) at their highest powers and multiply. Example: LCM(4,6) — 4=2², 6=2×3 → LCM=2²×3=12.
For any two positive integers a and b: GCD(a,b) × LCM(a,b) = a × b. If you know the GCD you can always find the LCM and vice versa. Example: GCD(12,18)=6 → LCM=(12×18)÷6=36.
GCD: equal-group division, fraction simplification, largest tile that fits a floor. LCM: earliest meeting / repeating cycle problems, finding a common denominator, synchronising repeating events.
Couldn't find the answer you were looking for?
Explore all our tools and get the fastest answer to your question.