Tools

Home
Percentage CalcUnit ConverterBMI CalculatorCalculatorTip Calculator

GCD & LCM Calculator

Enter two or more numbers to find the Greatest Common Divisor and Least Common Multiple instantly

Your files never leave your browser
Enter at least two positive integers separated by commas. Example: 48, 36 or 12, 18, 24
Greatest Common Divisor (GCD)
-
Least Common Multiple (LCM)
-
Step-by-step: Euclidean Algorithm (GCD) ▼
Prime Factorization ▼
LCM Calculation ▼
Ready·Enter numbers above

Plug in two or more whole numbers and get the GCD and LCM calculated instantly, with every Euclidean algorithm step and prime factorization shown so you can follow the math or drop it straight into an assignment. And everything runs in your browser. Nothing gets uploaded.

How It Works

Enter Numbers
➔
Euclidean Algorithm
➔
GCD & LCM + Steps

The calculator uses the Euclidean algorithm — it repeatedly divides the larger number by the smaller and takes the remainder until hitting zero. That last non-zero remainder is your GCD. For LCM, it applies the formula: LCM(a, b) = (a × b) / GCD(a, b). When you enter three or more numbers, it chains the results: find GCD of the first two, then GCD of that result with the third, and so on.

Examples

Simplifying a Fraction

You need to reduce 48/36 to lowest terms for a recipe conversion.

INPUT
48, 36
OUTPUT
GCD = 12 48/36 → 4/3

Scheduling Overlapping Cycles

One machine runs every 18 minutes, another every 24 minutes. You want to know when they sync up again.

INPUT
18, 24
OUTPUT
GCD = 6 LCM = 72 Both sync every 72 min

Three-Number Problem in a Math Class

A teacher asks: find the GCD and LCM of 12, 18, and 30. The step-by-step breakdown is what matters here — not just the answer.

INPUT
12, 18, 30
OUTPUT
GCD = 6 LCM = 180 (full Euclidean steps shown)

Who Uses This

🎓 Students

Checking homework answers and getting the step-by-step work to show the teacher.

👨‍🏫 Teachers

Generating worked examples for lesson plans or verifying answer keys.

🔧 Engineers

Calculating gear ratios, timing intervals, and signal frequencies that need common factors.

💻 Developers

Quick-checking GCD/LCM logic in code without spinning up a REPL or writing a test.

Common Mistakes

Entering only one number

GCD and LCM need at least two numbers to compare. If you type a single number, the calculator has nothing to work with. Add a comma and a second value.

Using decimals or negative numbers

GCD and LCM are defined for positive integers. Entering 3.5 or -12 won't work here. Round to whole numbers first, or take the absolute value if you are dealing with negatives.

Confusing GCD with LCM

GCD gives you the largest shared factor (always smaller or equal to your inputs). LCM gives the smallest shared multiple (always larger or equal). For 12 and 18: GCD is 6, LCM is 36. They go in opposite directions.

Technical Details

Frequently Asked Questions

What is the GCD of two numbers?

The GCD (Greatest Common Divisor) is the biggest number that divides evenly into both of your inputs. Some textbooks call it HCF — Highest Common Factor. Same thing, different name. For 24 and 36, the GCD is 12.

How do you find the LCM of two numbers?

Fastest way: find the GCD first, then use LCM(a, b) = (a × b) / GCD(a, b). You could also list multiples of each number until you spot the first overlap, but that gets tedious with bigger numbers. This calculator does both methods and shows you the work.

What is the Euclidean algorithm?

A method from around 300 BC that finds the GCD by dividing and taking remainders. You divide the bigger number by the smaller, keep the remainder, then repeat. When the remainder hits zero, the previous remainder is your GCD. Fast even for large numbers — no prime factoring needed.

Can I use this for more than two numbers?

Yes. Type as many numbers as you need, separated by commas. The calculator chains results — it finds GCD(a, b) first, then GCD(that result, c), and keeps going. Same approach for LCM. The step-by-step panel shows every intermediate calculation.

What is the relationship between GCD and LCM?

For any two positive integers, GCD × LCM = the product of those two numbers. So if you know one, you can get the other. That is why this calculator finds GCD first and then derives LCM from it — more efficient than listing multiples.

Share: