LCM and GCD calculator
Calculate the least common multiple (LCM) and greatest common divisor (GCD) of two numbers.
How the calculation works
These are two sibling concepts, common with fractions and periodic "meeting" problems.
- GCD (greatest common divisor): the largest number dividing both.
- LCM (least common multiple): the smallest number that is a multiple of both.
Computing the GCD (Euclid's algorithm)
Divide the larger by the smaller and keep the remainder; repeat with the smaller and the remainder until the remainder is zero. The last divisor is the GCD.
E.g. GCD(18, 12) → 18 ÷ 12 rem 6 → 12 ÷ 6 rem 0 → GCD = 6.
Computing the LCM
With the GCD in hand, use the relation linking both:
LCM × GCD = A × B → LCM = A × B ÷ GCD
E.g. LCM(18, 12) = 216 ÷ 6 = 36.
Where it shows up
- LCM: adding fractions (common denominator), syncing events.
- GCD: simplifying fractions, splitting into equal groups of the largest possible size.
Examples
- GCD(12, 18) = 6; LCM(12, 18) = 36. Check: 6 × 36 = 12 × 18 = 216.
- Coprime numbers (e.g. 8 and 9): GCD = 1 and LCM = 8 × 9 = 72.
Frequently asked questions
What is the LCM for?
It is widely used to add fractions with different denominators and to solve problems of events repeating at different intervals.
Difference between LCM and GCD?
The GCD is the largest common divisor (a small number that fits into both); the LCM is the smallest common multiple (a number at least as large as both).
What does a GCD of 1 mean?
That the numbers are coprime — no common divisor other than 1. In that case the LCM is simply their product.
How do I know whether to use LCM or GCD?
Ask "when do they coincide again?" for LCM, and "what is the largest equal piece?" for GCD.
Is there a shortcut linking LCM and GCD?
Yes, for two numbers: LCM × GCD = a × b. It does not extend directly to three or more.
What is the Euclidean algorithm?
A fast way to find the GCD: divide, then divide the divisor by the remainder, repeating until zero.
Related calculators
More Students calculators
See all →Quadratic formula
Solve quadratic equations (ax² + bx + c = 0) with the delta and roots step by step.
Grade needed
Find out the grade you need on the final exam to reach the required average.
Grade calculator
Find the percentage and letter grade of a test from the total questions and how many you missed.
Linear equation
Solve first-degree equations in the form ax + b = c, with a check of the result.
Power & root
Calculate powers (base raised to an exponent) and roots (square and nth).
GPA
Calculate your GPA on the 4.0 scale from letter grades and credit hours per course.
Weighted average
Calculate the weighted average from values and their corresponding weights.
Updated on June 17, 2026 · by Rafael Rossi · Methodology & sources