LCM & GCD Calculator

This free online LCM and GCD calculator finds the Least Common Multiple and Greatest Common Divisor of two or more positive integers at once. Just list your numbers separated by commas and get both results instantly, worked out using the Euclidean algorithm.


How to Use the LCM & GCD Calculator

  1. Enter two or more positive integers, separated by commas, in the "Enter Two or More Positive Integers" field (e.g. 12, 18, 24).
  2. Click "Calculate".
  3. Read the GCD (Greatest Common Divisor) and LCM (Least Common Multiple) from the results table.

Two Ways to Find GCD (HCF) and LCM

The GCD is also called the HCF (Highest Common Factor) in Indian school textbooks. Take 84 and 126 as an example.

Euclidean algorithm (what the calculator uses): divide the larger number by the smaller and keep the remainder. 126 ÷ 84 leaves 42. Then 84 ÷ 42 leaves 0. The last non-zero remainder, 42, is the GCD. This method stays fast even for very large numbers because the values shrink quickly at each step.

Prime factorisation (the classroom method): 84 = 2² × 3 × 7 and 126 = 2 × 3² × 7. The GCD takes the lowest power of each shared prime: 2 × 3 × 7 = 42. The LCM takes the highest power of every prime that appears: 2² × 3² × 7 = 252.

For two numbers there is a handy check: GCD × LCM = the product of the numbers. Here 42 × 252 = 10,584 = 84 × 126. This shortcut does not hold for three or more numbers, which is why the calculator works through the list in pairs.

Sample Results

NumbersGCD (HCF)LCM
12, 18, 24672
84, 12642252
36, 48, 6012720
15, 20, 255300

Which One Does a Word Problem Need?

  • GCD answers "the largest equal piece" questions. A floor measuring 360 cm by 480 cm can be covered without cutting by square tiles up to 120 cm wide, because the GCD of 360 and 480 is 120. GCD is also used to reduce fractions: 84/126 divided top and bottom by 42 becomes 2/3.
  • LCM answers "when will they coincide again" questions. Three bells ringing every 15, 20 and 25 minutes ring together again after 300 minutes, or 5 hours. LCM also gives the lowest common denominator when adding fractions.

The LCM can grow very quickly with longer lists of numbers. Once it passes about 9 × 10¹⁵, the browser can no longer store whole numbers exactly, so treat extremely large LCM results as approximate.

Frequently Asked Questions

It uses the Euclidean algorithm to find the GCD of the first two numbers, then repeats that pairwise with each remaining number. The LCM is calculated the same way using the formula LCM(a, b) = (a × b) / GCD(a, b) across all values.

Yes. You can enter as many comma-separated positive integers as you like, as long as there are at least two, for example 12, 18, 24.

Yes. Greatest Common Divisor (GCD), Highest Common Factor (HCF) and Greatest Common Factor (GCF) are three names for the same thing: the largest whole number that divides every number in the list exactly.

It means the numbers share no common factor other than 1; they are called co-prime. For two co-prime numbers, such as 8 and 15, the LCM is simply their product, 120.

The calculator splits the input only at commas. Spaces around the commas are fine, but "12 18 24" without commas is read as a single entry and rejected. Type 12, 18, 24 instead.
No ratings yet — be the first!
Rate this calculator:
Was this tool helpful?