Calculate Now
What is LCM & GCD Calculator?
Two whole numbers relate to each other in two useful ways: the largest number that divides evenly into both of them (their Greatest Common Divisor) and the smallest number that both of them divide evenly into (their Least Common Multiple). These solve different everyday problems โ GCD helps simplify fractions, while LCM helps find common denominators or figure out when two repeating events line up. This calculator computes both at once for any pair of numbers you enter.
Euclidean Algorithm & LCM Formula
GCD is computed using the Euclidean algorithm, which repeatedly replaces the larger number with the remainder of dividing it by the smaller number until the remainder is zero. Once GCD is known, LCM follows directly from it:
Worked Example
Find the GCD and LCM of 18 and 24.
Using the Euclidean algorithm: 24 รท 18 leaves remainder 6; then 18 รท 6 leaves remainder 0 โ so GCD(18, 24) = 6.
So the GCD is 6 and the LCM is 72.
How to Use This Calculator
- Enter the first number in the First Number field.
- Enter the second number in the Second Number field.
- Click Calculate to see both the GCD and LCM.
Why the Euclidean Algorithm Works
The Euclidean algorithm relies on a simple fact: the greatest common divisor of two numbers also divides their difference (and therefore their remainder after division). By repeatedly replacing the larger number with the remainder from dividing it by the smaller one, the pair of numbers shrinks quickly while their GCD stays the same, until eventually the remainder hits zero and the last non-zero remainder is the answer. This makes it far faster than listing out every factor of both numbers, especially once the numbers get large.
GCD is also the key step in reducing a fraction to its lowest terms, which is essentially the same math used in our Ratio Calculator.
📅 Last reviewed: July 2026 · Formulas verified against RBI/SEBI/IT Dept guidelines.