GCD and LCM Calculator
HCF (GCD) and LCM of two or more numbers, with Euclid steps, prime factorisation, and the simplest ratio.
How it works
Type two or more whole numbers. The tool gives the GCD (also called HCF, the biggest number that divides all of them) and the LCM (the smallest number all of them divide into). It shows Euclid steps for the first two numbers and the prime factors of each number, so you can write the working in an exam.
The simplest ratio row divides every number by the GCD.
The formula
Euclid: gcd(a, b) = gcd(b, a mod b). lcm(a, b) = a x b / gcd(a, b)
Worked example
12, 18 and 24: 12 = 2^2 x 3, 18 = 2 x 3^2, 24 = 2^3 x 3. GCD takes the lowest power of each prime: 2 x 3 = 6. LCM takes the highest: 2^3 x 3^2 = 72.
Good to know
- GCD x LCM = product of the two numbers, but only for exactly two numbers.
- Use LCM to add fractions with different bottoms, and GCD to simplify them.
- Word problems: "bells ring together again" is an LCM question, "largest tile that fits" is a GCD question.
Common questions
- What is the difference between HCF and GCD?
- Nothing. HCF (highest common factor) is the school name, GCD the usual maths name.
- What does co-prime mean?
- The GCD is 1, so the numbers share no factor except 1.
- Can I use negative numbers or zero?
- No. Use whole numbers above 0.
- How large can the numbers be?
- Up to 30 digits each. Prime factors are shown for the numbers where this finishes quickly.
More in Utilities.
Find the date that is some days, weeks, months, years or working days from a date, and see the weekday and week number.
OPEN →Age CalculatorYour exact age in years, months and days, the day you were born, your next birthday, and the age gap with another person.
OPEN →Area ConverterConvert square metres, square feet, acres, hectares and more.
OPEN →