🔗 GCD & LCM Calculator (HCF and LCM)

Greatest common divisor and least common multiple — with Euclid’s steps.

No ratings yet — be the first

Enter details

Two or more whole numbers.

Log in or create a free account to save your inputs and results, so you don't have to enter them again next time.🔒 No spam, ever. We never sell or share your details, and you can delete your history or account at any time. Privacy policy

Fill in the details and click Calculate to see your results.

Formula at a glance

GCD & LCM Calculator: Euclid’s algorithm — gcd(a, b) = gcd(b, a mod b). Example: 12, 18 and 30 → GCD (HCF): 6
How the GCD & LCM Calculator works: Euclid’s algorithm — gcd(a, b) = gcd(b, a mod b)

Rate this calculator

Was it useful? A quick star rating helps others — and you can leave a comment too.
Rate it: ★ ★ ★ ★ ★

📘 About the GCD & LCM Calculator

The greatest common divisor (GCD, also called HCF or GCF) is the largest number that divides all the numbers; the least common multiple (LCM) is the smallest number they all divide into. HCF simplifies fractions and shares things into equal groups; LCM finds common denominators and when repeating events line up.

Enter two or more whole numbers. The calculator shows Euclid’s algorithm (divide, keep the remainder, repeat), the prime factorisation of each number, and both answers, with the check GCD × LCM = a × b for two numbers.

🧮 Formula

Euclid’s algorithm
gcd(a, b) = gcd(b, a mod b)
LCM
lcm(a, b) = a × b / gcd(a, b)
From prime factors
GCD: lowest powers · LCM: highest powers

✏️ Worked examples

12, 18 and 30

You enter
Numbers12, 18, 30
You get
GCD (HCF)6
LCM180
Numbers12, 18, 30
Co-prime?No — common factor 6

GCD 6, LCM 180.

84 and 120

You enter
Numbers84, 120
You get
GCD (HCF)12
LCM840
Numbers84, 120
Co-prime?No — common factor 12
CheckGCD × LCM = 10,080 = 84 × 120

GCD 12, LCM 840.

🧭 How to use this calculator

What you enter

  • NumbersTwo or more whole numbers.

What you get

  • GCD (HCF)
  • LCM
  • Numbers
  • Co-prime?

❓ Frequently asked questions

What is the difference between HCF and LCM?

HCF is the biggest number that goes into all of them; LCM is the smallest number all of them go into.

How do you find the HCF by prime factorisation?

Write each number as a product of primes and multiply the common primes with their lowest powers: 12 = 2²·3, 18 = 2·3² → HCF = 2·3 = 6.

When are two numbers co-prime?

When their GCD is 1, like 8 and 15.