Part of the Maths & Statistics suite · 235 calculators

GCD and LCM Calculator

Find the greatest common divisor (highest common factor) and the least common multiple of two or more whole numbers, with the prime factors that explain them.

The GCD (also called HCF) is the largest number that divides all of the inputs; the LCM is the smallest number they all divide into.

Two or more, comma-separated
Results update as you type
Results
Greatest common divisor
6
Least common multiple
Numbers entered
Coprime?
Reviewed September 2026. Pure mathematics: the result does not depend on where you are. Terminology follows the Australian Curriculum (maths, brackets, decimal point).
No account required · Google Analytics off unless allowedCalculator arithmetic runs in your browserResults update as you type
All calculations run 100% in your browser. The calculator code does not submit your figures to GlobalCalc to obtain a result.
About gcd and lcm

How the gcd and lcm calculator works

The GCD (also called HCF) is the largest number that divides all of the inputs; the LCM is the smallest number they all divide into. Euclid's algorithm finds the GCD by repeated remainders; for two numbers, LCM = a × b ÷ GCD. For more numbers the calculator folds the operation across the list.

Formula: gcd(a, b) = gcd(b, a mod b); lcm(a, b) = |a × b| / gcd(a, b)

Worked examples

InputsGreatest common divisorNote
12, 18, 306gcd 6, lcm 180
8 and 124gcd 4, lcm 24
7 and 91coprime; lcm 63

Frequently asked questions

What is the difference between GCD and HCF?

Nothing — greatest common divisor and highest common factor are the same thing.

When do I need the LCM?

Adding fractions with different denominators (the common denominator is the LCM) and timing problems ("when do the two buses next leave together?").

How does Euclid's algorithm work?

Replace the larger number with the remainder of dividing it by the smaller, and repeat until the remainder is zero; the last non-zero number is the GCD.

What is the LCM of three numbers?

Take the LCM of the first two, then the LCM of that result and the third.

Does 0 have a GCD?

gcd(a, 0) = a for any a; the calculator ignores zeros.

Where these figures come from

Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.