GCD & LCM Calculator
Enter two to six positive integers to see their GCD and LCM, Euclidean steps, prime factors and the reduced fraction for a pair.
Equal groups and shared schedules are different jobs
A teacher has 42 pencils and 56 erasers and wants the largest number of identical supply kits with nothing left over. The answer, 14 kits, comes from the GCD. If two maintenance checks are done today and then repeat every 8 and 12 days, their next shared date is 24 days away; that is an LCM question. The same pair of operations handles division into equal groups and alignment of repeating cycles, but the required result is not interchangeable.
The greatest common divisor is the largest positive integer that divides every input exactly. The least common multiple is the smallest positive integer divisible by every input. For 12 and 18 those values are 6 and 36. This distinction matters more than spotting a familiar phrase: decide whether the unknown must divide the given numbers or be a multiple of them.
Remainders reveal the divisor without long factor lists
The Euclidean algorithm turns a large pair into smaller remainders. With 252 and 105, write 252 = 2 × 105 + 42, then 105 = 2 × 42 + 21 and finally 42 = 2 × 21. The last non-zero divisor is 21. The result shows this trail for the first two entries, which helps when checking a copied number.
Prime factorisation provides an independent check. Since 72 = 2³ × 3² and 120 = 2³ × 3 × 5, take the shared primes at their lower powers: 2³ × 3 = 24. For an LCM, keep every prime that appears and use its highest power. One factor list can therefore support both calculations without treating GCD and LCM as the same quantity.
The multiple comes from the same number pair
For two positive integers, LCM(a,b) = a / GCD(a,b) × b. Dividing before multiplying limits the intermediate value; 12 / 6 × 18 gives 36. An LCM calculator can also confirm the result from prime powers. The identity GCD(a,b) × LCM(a,b) = a × b is useful for checking a pair, but it does not extend unchanged to the product of three or more inputs.
Lists, fractions and wording clues need separate checks
More than two values are processed one pair at a time. For 24, 36 and 60, first find GCD(24,36) = 12 and then GCD(12,60) = 12. The LCM follows the same reduction pattern. If one number divides another, as 8 divides 24, the smaller number is the GCD and the larger is the LCM.
- “Largest equal groups” or “longest equal pieces” usually asks for a common divisor.
- “First time together” or “smallest shared total” points to a common multiple.
- Reducing a fraction uses the GCD of its numerator and denominator.
These clues help with GCD and LCM problems, though the requested relationship is the final test. For 84/126, dividing both terms by 42 produces 2/3. If the GCD is 1, the fraction is already in lowest terms. Common denominators use an LCM instead: denominators 6 and 8 can first be rewritten over 24.
This GCD and LCM calculator accepts two to six integers from 1 to 999,999,999. Empty extra rows are skipped, but at least two values are required. Write 12000 or 12,000; the comma is a thousands separator. Decimals and scientific notation such as 1e3 are not accepted.
The LCM may have far more digits than any input. BigInt arithmetic preserves the integer exactly, including in copied results; the nine-digit limit applies to each input, not the answer. For a list, the main results cover every value while the Euclidean steps show only the first pair. The fraction panel appears only with two filled entries. The number 1 has no prime factors. Zero and negatives are excluded by this tool, although GCD has a broader mathematical definition.
Sources & Data Currency
Frequently Asked Questions About the GCD & LCM Calculator
GCD is the greatest positive integer dividing every input. LCM is the least positive integer divisible by every input. For 12 and 18, GCD is 6 and LCM is 36.
Use the Euclidean algorithm: divide the larger number by the smaller, then continue with the divisor and remainder. When the remainder reaches zero, the last divisor is the GCD. The steps shown here cover the first two entries.
For two positive integers, use LCM(a,b) = a / GCD(a,b) × b. Finding the LCM by prime factors means taking every factor at its highest exponent.
Largest equal groups usually indicate GCD. First shared time, repeated cycles or the least shared total usually indicate LCM. Check whether a common divisor or multiple is required.
Couldn't find the answer you were looking for?
Explore all our tools and get the fastest answer to your question.