GCD & LCM Calculator
Find the greatest common divisor (GCD) and least common multiple (LCM) of two or more integers using Euclid's algorithm, with the working shown.
Pairwise working
Greatest common divisor
gcd(12, 18) = 6
gcd(6, 30) = 6
Least common multiple
lcm(12, 18) = 36
lcm(36, 30) = 180
- GCD and LCM of two or more integers
- Uses Euclid's algorithm for speed and accuracy
- Pairwise reasoning shown for the whole list
- Accepts comma, space and newline separated input
- Handles large integers reliably
- 100% private — runs entirely in your browser
How to use the GCD & LCM Calculator
- 1
Enter two or more integers, separated by commas, spaces or new lines.
- 2
Read the greatest common divisor (GCD) of the whole list.
- 3
Read the least common multiple (LCM) below it.
- 4
Review the pairwise working to see how each was reached.
- 5
Click Copy to grab the results.
About the GCD & LCM Calculator
The ByteTools GCD & LCM Calculator finds the greatest common divisor and least common multiple of two or more whole numbers. Enter a list and it computes both using Euclid's algorithm, applied pairwise across all your values, with the reasoning shown so the method is clear.
The GCD is the largest number that divides every value, and the LCM is the smallest number they all divide into. Together they are essential for adding fractions, scheduling repeating events and simplifying ratios. The tool suits students, teachers and developers alike.
All calculation happens in your browser with JavaScript. No numbers are uploaded, so the tool is private, fast and works offline. Copy both results with one click.
Frequently asked questions
What is the difference between GCD and LCM?
The greatest common divisor (GCD) is the largest number that divides all the values with no remainder. The least common multiple (LCM) is the smallest number that all the values divide into. For 4 and 6, the GCD is 2 and the LCM is 12.
How does Euclid's algorithm find the GCD?
Repeatedly replace the larger number with the remainder of dividing it by the smaller number. When the remainder reaches zero, the last non-zero value is the GCD. It is fast because the numbers shrink quickly.
How is the LCM calculated from the GCD?
For two numbers, LCM = (a × b) ÷ GCD(a, b). For more than two, the tool folds this across the list, combining the running LCM with each new value. This avoids overflow better than multiplying everything first.
Can I find the GCD and LCM of more than two numbers?
Yes. Enter any list and the calculator applies the operations pairwise: GCD(a, b, c) = GCD(GCD(a, b), c), and similarly for LCM. This extends naturally to as many numbers as you enter.
What is the GCD if one number is zero?
GCD(a, 0) is a, because every number divides zero. The LCM involving zero is defined as zero. The calculator handles these edge cases so your results stay consistent.
Related tools
- Prime Factorization CalculatorFind the prime factorization of any integer. See the prime factors with exponents and the …
- Prime Number CheckerCheck whether a number is prime or composite. See the smallest factor and the full list of…
- Fraction SimplifierReduce any fraction to its lowest terms online. See the greatest common divisor used, the …
- Fraction CalculatorAdd, subtract, multiply and divide two fractions online. Get the result as an improper fra…
- Ratio CalculatorSimplify a ratio to its lowest terms or solve a proportion A:B = C:? to find the missing v…