LCM & GCD Calculator

Calculate least common multiple and greatest common divisor.

How to use LCM & GCD Calculator

1

Enter your first number

Click the 'First Number' input field at the top of the calculator and type your first positive integer. You can enter numbers up to 999,999.

2

Enter your second number

Click the 'Second Number' input field directly below the first number and type your second positive integer. Both fields accept whole numbers only.

3

Click the Calculate button

Press the blue 'Calculate' button located beneath both input fields to process your numbers instantly.

4

View your results

The results section displays both the GCD (Greatest Common Divisor) and LCM (Least Common Multiple) in separate labeled boxes with clear formatting.

5

Clear and calculate again

Click the 'Clear' button to reset all fields and enter new numbers. Your previous results will be erased immediately.

Related Tools

LCM and GCD calculator: find multiples and divisors instantly

LCM and GCD calculator: find multiples and divisors instantly

Find the Least Common Multiple (LCM) and Greatest Common Divisor (GCD) of any set of numbers at ToolHQ's LCM and GCD calculator, free, no account required, with step-by-step working using the Euclidean algorithm.

The LCM is the smallest number that is evenly divisible by all the numbers in a set. The GCD (also called Greatest Common Factor) is the largest number that divides evenly into all the numbers in a set.

These two concepts appear throughout mathematics and real life: adding fractions, simplifying ratios, scheduling events, and solving problems in music, engineering, and computing. ToolHQ's calculator handles multiple numbers at once and shows the step-by-step working so you understand how each result was reached.

Key Takeaways

  • Find LCM and GCD for two or more numbers simultaneously in one calculation
  • Step-by-step working shown using the Euclidean algorithm for GCD
  • LCM and GCD are related: LCM(a,b) × GCD(a,b) = a × b
  • No data is stored or transmitted, all calculations run locally in your browser
  • Useful for fraction operations, scheduling, ratio simplification, and math education

What are LCM and GCD and how does the calculator work?

Greatest Common Divisor (GCD): The largest positive integer that divides all the numbers in a set without leaving a remainder. Also called the Greatest Common Factor (GCF) or Highest Common Factor (HCF).

Least Common Multiple (LCM): The smallest positive integer that all numbers in a set divide into evenly.

ToolHQ's calculator finds both simultaneously. It uses the Euclidean algorithm for GCD, one of the oldest and most efficient algorithms in mathematics, attributed to the Greek mathematician Euclid around 300 BC.

The Euclidean algorithm for GCD (two numbers):

  1. Divide the larger number by the smaller: a ÷ b = quotient, remainder r
  2. Replace: set a = b, b = r
  3. Repeat until the remainder is 0
  4. The last non-zero remainder is the GCD

Example: GCD(48, 18)

  • 48 ÷ 18 = 2, remainder 12. Now: a=18, b=12
  • 18 ÷ 12 = 1, remainder 6. Now: a=12, b=6
  • 12 ÷ 6 = 2, remainder 0. GCD = 6

Once the GCD is known, LCM follows from the relationship: LCM(a,b) = (a × b) / GCD(a,b). For 48 and 18: LCM = (48 × 18) / 6 = 864 / 6 = 144.

For the Least Common Multiple, the calculator also supports the prime factorization method: express each number as a product of prime factors, then multiply the highest power of each prime that appears.

All calculations run locally in your browser, no data is stored or transmitted.


When to use LCM and GCD

LCM and GCD solve different types of problems. Here is a practical guide to which one you need:

Problem type Use Example
Adding or subtracting fractions with different denominators LCM (as the LCD) 1/4 + 1/6 → LCD = LCM(4,6) = 12
Simplifying (reducing) a fraction GCD 18/24 → GCD(18,24) = 6 → 3/4
Finding when two repeating events coincide again LCM Events every 4 and 6 days meet again at day 12
Dividing something equally into the largest possible groups GCD Split 48 and 36 items → GCD(48,36) = 12 groups
Simplifying a ratio to lowest terms GCD 24:36 → GCD(24,36) = 12 → 2:3
Finding a common time cycle for scheduling LCM Bus A every 15 min, Bus B every 20 min → both arrive every LCM(15,20) = 60 min
Checking if two numbers are coprime (share no factors) GCD GCD = 1 means coprime

Mini-story 1: Ms. Chen is an eighth-grade math teacher. She was preparing a worksheet on adding fractions with unlike denominators and needed to generate problems with specific difficulty levels. She entered pairs of denominators into ToolHQ's LCM GCD calculator to find the Least Common Denominator for each, then verified the step-by-step working matched the method she taught in class. The calculator saved her from checking each pair manually and gave her confidence the worked examples on the answer key were correct.

Calculate LCM and GCD free at ToolHQ


How to use the ToolHQ LCM and GCD calculator

The process is instant:

  1. Go to the tool. Navigate to ToolHQ's LCM and GCD calculator. No account or sign-up required.
  2. Enter your numbers. Input two or more integers, separated by commas. The tool handles any quantity of inputs.
  3. Click Calculate. The tool instantly returns both the LCM and GCD.
  4. Review the step-by-step working. The Euclidean algorithm steps are shown so you can follow and verify the process.
  5. Use the results. Apply the LCM as a common denominator, use the GCD to simplify a fraction or ratio, or use either for scheduling problems.

The relationship between LCM and GCD

One of the most useful identities in number theory is:

LCM(a, b) × GCD(a, b) = a × b

This means if you know the LCM, you can find the GCD by dividing (a × b) by LCM, and vice versa. For example, if GCD(24, 36) = 12, then LCM(24, 36) = (24 × 36) / 12 = 864 / 12 = 72.

This relationship only holds for exactly two numbers, for three or more numbers, the Euclidean algorithm must be applied step by step.

If you want to understand the prime factor structure of any number in your set, ToolHQ's prime number checker shows full prime factorization for any number, which complements the LCM/GCD calculation.

Mini-story 2: Omar is a production planner at a manufacturing facility. Two machines on the same production line run maintenance cycles: Machine A needs a check every 8 hours and Machine B every 12 hours. He needed to find when both machines would be in maintenance at the same time so he could plan a coordinated downtime window. He entered 8 and 12 into ToolHQ's LCM calculator and got 24, both machines align every 24 hours. He scheduled the downtime window accordingly, avoiding the need to shut each machine down separately.


Frequently asked questions

What is the difference between LCM and GCD?

LCM (Least Common Multiple) is the smallest number all inputs divide into evenly. GCD (Greatest Common Divisor) is the largest number that divides all inputs evenly. They solve opposite types of problems.

Can I find LCM and GCD for more than two numbers?

Yes. ToolHQ's calculator accepts two or more numbers simultaneously. For multiple inputs, the algorithm is applied iteratively: GCD(a,b,c) = GCD(GCD(a,b),c).

What is the Euclidean algorithm?

The Euclidean algorithm finds the GCD by repeatedly dividing and taking remainders until the remainder is zero. The last non-zero remainder is the GCD. It is one of the most efficient algorithms for this calculation.

Can LCM be smaller than the original numbers?

No. LCM is always greater than or equal to the largest number in the set. GCD is always less than or equal to the smallest number.

Is the LCM GCD calculator free?

Yes. ToolHQ's calculator is completely free, with no account, no sign-up, and no usage limits.


The short version

LCM and GCD are fundamental tools in arithmetic, for adding fractions, simplifying ratios, scheduling repeating events, and working with any problem that involves finding common factors or multiples. ToolHQ's LCM and GCD calculator handles any set of numbers, shows step-by-step Euclidean algorithm working, and returns both values at once. It is free, instant, and requires no account.

For related number theory tools, ToolHQ's prime number checker finds prime factorizations, the number base converter converts between binary, decimal, hex and octal, and the percentage calculator handles ratio and proportion problems. Explore more calculator tools at ToolHQ.

Calculate LCM and GCD free at ToolHQ