GCD and LCM Calculator
The greatest common divisor and the least common multiple.
Tip: The GCD helps simplify fractions; the LCM helps add fractions with different denominators.
Did this tool help?
About this digital tool
This calculator finds the greatest common divisor (GCD) and the least common multiple (LCM) of two numbers. Enter the first number (a) and the second (b) and get the GCD, the LCM, the ratios a/GCD and b/GCD, as well as the simplified ratio.
The GCD is found with the Euclidean algorithm, while the LCM uses the formula LCM = a × b ÷ GCD. For 12 and 18: 18 ÷ 12 leaves remainder 6, 12 ÷ 6 leaves remainder 0, so GCD = 6. Then LCM = 12 × 18 ÷ 6 = 36. The GCD is used for simplifying fractions and ratios, while the LCM is used for adding fractions with different denominators and for problems with events that repeat periodically.
How to use
- Enter the first number (a) in the first field.
- Enter the second number (b) in the second field; both must be non-zero.
- Read the GCD and the LCM that appear instantly.
- See the simplified ratio a : b to use with fractions.
Frequently asked questions
How is the GCD calculated with Euclid's algorithm?
Divide the larger number by the smaller; then divide the smaller by the remainder; continue until the remainder is 0. The last non-zero divisor is the GCD.
What is the LCM and how is it calculated?
The LCM is the smallest number divisible by both numbers. It is calculated as a × b ÷ GCD. E.g. for 4 and 6, GCD = 2, so LCM = 24 ÷ 2 = 12.
How are the GCD and LCM related?
Their product equals the product of the two numbers: GCD × LCM = a × b. E.g. for 12 and 18: 6 × 36 = 216 = 12 × 18.
How do I use the GCD to simplify a fraction?
Divide the numerator and denominator by their GCD. E.g. 18/24: GCD = 6, so the fraction simplifies to 3/4.