GCD/LCM Calculator
Calculate the greatest common divisor and least common multiple online. Free GCD/LCM calculator with step-by-step solutions shown.
How to Use GCD/LCM Calculator
Enter numbers
Type two or more positive integers separated by commas into the input.
Calculate
The calculator returns both the greatest common divisor and the least common multiple in a single pass.
View steps (optional)
Some calculators expand the Euclidean algorithm step by step, which is genuinely useful when you are trying to understand why the answer is what it is rather than just see it.
Use in your work
Apply the result wherever you need it — fraction simplification, common denominator math, scheduling problems, or verifying a custom GCD implementation.
When to Use GCD/LCM Calculator
Math homework and classroom support
Greatest common divisor and least common multiple show up across middle school and high school number theory units. The calculator returns answers immediately and can show the Euclidean algorithm step by step, which makes it useful both for students learning the concept and for teachers checking dozens of problem sets without doing every calculation by hand.
Fraction simplification and arithmetic
Reducing 12/16 to 3/4 means dividing top and bottom by their GCD, which is 4. Adding fractions like 1/4 plus 1/6 means finding the LCM of the denominators, which is 12, and rewriting both fractions over that common denominator. The calculator hands you both numbers in one pass, which speeds up any work that involves fractions in classroom problems or real recipes and measurements.
Programming and algorithm checks
GCD and LCM problems appear constantly in coding interviews, algorithm exercises, and competitive programming. Running your custom implementation against the calculator on a few representative inputs catches edge cases you might have missed, especially around zero, negative numbers, and very large values where the Euclidean algorithm has interesting behavior.
Number theory exploration
The identity GCD(a,b) times LCM(a,b) equals a times b connects these two operations elegantly, and coprime pairs — those with GCD equal to 1 — sit at the heart of RSA and other cryptographic schemes. The calculator gives you a quick way to play with these relationships and build intuition before diving into the heavier theory.
GCD/LCM Calculator Examples
Simple GCD
GCD(12, 18)6Both 12 and 18 are divisible by 1, 2, 3, and 6. The greatest of those shared divisors is 6, which is exactly what the Euclidean algorithm produces in two steps.
Simple LCM
LCM(4, 6)12The least common multiple of 4 and 6 is the smallest number both divide cleanly. Using the formula LCM = a times b divided by GCD, you get 24 divided by 2, which lands on 12.
Multiple numbers
GCD(12, 18, 24)6Multi-number GCD reduces to pairwise application. Take GCD of 12 and 18 to get 6, then take GCD of that result with 24, which is also 6. The same approach extends to any quantity of inputs.
Tips & Best Practices for GCD/LCM Calculator
- 1.The Euclidean algorithm — GCD(a,b) equals GCD(b, a mod b) — is the standard implementation and runs in logarithmic time, which means it stays fast even on numbers with hundreds of digits.
- 2.For any pair of numbers, GCD times LCM equals the product. That identity sometimes lets you compute one quantity from the other rather than running both algorithms separately.
- 3.A GCD of 1 means the two numbers are coprime, sharing no common factor larger than 1. This property is what makes RSA encryption work and shows up throughout number theory.
- 4.When two numbers are coprime, their LCM is just their product, no division required. That makes the math much faster when you can spot the relationship in advance.
- 5.For three or more numbers, both GCD and LCM reduce pairwise. Compute the result for the first two, then combine with the third, and so on through the list.
- 6.LCM has a real-world meaning in scheduling. Two events that recur every 12 and 18 days will coincide every 36 days, which is the LCM of the two periods.
Frequently Asked Questions
Related Tools
Temperature Converter
Convert between Celsius, Fahrenheit, and Kelvin online. Free temperature converter with instant results and conversion formulas.
Length Converter
Convert between meters, feet, inches, miles, and more length units online. Free length converter with instant accurate results.
Weight Converter
Convert between kilograms, pounds, ounces, grams, and more weight units online. Free mass converter with instant calculations.
Area Converter
Convert between square meters, square feet, acres, hectares, and more area units online. Free area converter with precision.
Volume Converter
Convert between liters, gallons, cups, milliliters, and more volume units online. Free volume converter with instant results.
Data Size Converter
Convert between bytes, KB, MB, GB, and TB online. Free data size converter for storage and bandwidth calculations with precision.