GCD & LCM Calculator

Calculate Greatest Common Divisor (GCD/HCF) and Least Common Multiple (LCM) for two or more numbers. Step-by-step. 100% private. 100% free and private.

How to use

  1. Enter Numbers — Type two or more positive integers separated by commas or spaces.
  2. Read GCD — The greatest common divisor (also called HCF) appears immediately.
  3. Read LCM — The least common multiple of all your numbers is shown beside it.
  4. Reuse in Math — Apply the results in fractions, ratios, or scheduling problems.

Frequently asked questions

What's the difference between GCD and HCF?

They are the same thing. GCD (Greatest Common Divisor) is the term used in most countries; HCF (Highest Common Factor) is common in the UK and South Asia.

How is GCD calculated?

We use the Euclidean algorithm, which repeatedly takes remainders. It runs in O(log n) steps and works for any pair of positive integers.

Can I include zero?

No. GCD with zero is defined but rarely useful. Enter positive integers only.

What about negative numbers?

GCD is usually defined as positive. Strip the minus signs before entering values.

How many numbers can I input?

Up to 20 in the UI; the algorithm scales to any count.

What is the largest number it handles?

JavaScript safe integers up to 2^53. Use BigInt-aware tools for cryptographic sizes.

What is GCD of negative numbers?

GCD is defined as positive — the sign is dropped.

Is the algorithm exact?

Yes — integer math, no floating-point error.

Is my input stored?

No. Local math only.

Free GCD & LCM Calculator

Find the Greatest Common Divisor (GCD or HCF) and Least Common Multiple (LCM) of two or more positive integers. Useful for simplifying fractions, ratio problems, and scheduling.

Common Uses

  • Simplify fractions to lowest terms
  • Solve word problems on ratios and proportion
  • Plan repeating schedules and cycles
  • Verify number theory homework
  • Demonstrate the Euclidean algorithm

How It Works

GCD is computed with the Euclidean algorithm: gcd(a,b) = gcd(b, a mod b). For more than two numbers we reduce pairwise. LCM uses the identity lcm(a,b) = a*b / gcd(a,b), again reduced across the list.

Privacy

All computation is local. Your numbers stay on your device.

Related: Prime Number Checker, Scientific Calculator, Percentage Calculator.

Related free tools

Browse all free tools · Guides and tutorials · PDF tools · Developer tools · Text tools · SEO tools