LCM and HCF Calculator

Type two or more numbers to get their HCF (GCD) and LCM, with the prime factorisation, the division method and Euclid's algorithm written out. It works for whole numbers, fractions and decimals.

2 to 20 numbers separated by commas or spaces. Whole numbers up to 1,000,000,000,000, fractions (3/4) or decimals (0.6).

HCF (GCD)
6
LCM
36
HCF × LCM = product
6 × 36 = 216
  • Common factors (4): 1, 2, 3, 6
  • First common multiples: 36, 72, 108, 144, 180, …

Prime factorisation method

  • 12 = 2 × 2 × 3 = 2² × 3
  • 18 = 2 × 3 × 3 = 2 × 3²

HCF: multiply the primes common to every number, each to its lowest power. HCF = 2 × 3 = 6

LCM: multiply every prime that appears, each to its highest power. LCM = 2² × 3² = 36

Listing method

Factors of each number; the HCF, in brackets, is the biggest one in every list.

  • 12: 1, 2, 3, 4, [6], 12
  • 18: 1, 2, 3, [6], 9, 18

Multiples of each number; the LCM, in brackets, is the first one in every list.

  • 12: 12, 24, [36]
  • 18: 18, [36]

Division method

LCM: divide by a prime that divides at least one number, bring the others down, until every number is 1. LCM = 2 × 2 × 3 × 3 = 36

LCM by the division method
Divide byNumber 1Number 2
21218
269
339
313
11

HCF: divide by primes that divide every number, until no prime divides them all. HCF = 2 × 3 = 6

HCF by the division method
Divide byNumber 1Number 2
21218
369
23

Euclid's algorithm (long division)

Divide the larger number by the smaller, then the smaller by the remainder, until the remainder is 0. The last divisor is the HCF.

  1. 18 = 12 × 1 + 6
  2. 12 = 6 × 2 + 0

HCF(18, 12) = 6

LCM from the HCF: LCM = 12 × 18 ÷ 6 = 36

How to use the LCM and HCF calculator

  1. Type your numbers separated by commas or spaces, for example 24, 36, 60. You can enter 2 to 20 numbers.
  2. For fractions use a slash (3/4) and for decimals a point (0.6). The answer updates as you type.
  3. Read the HCF and LCM at the top, then the working below: copy whichever method your book or exam asks for.

Four ways to find the HCF and LCM

1. Prime factorisation

Break each number into primes. The HCF takes the primes every number shares, each to its lowest power; the LCM takes every prime that appears, each to its highest power. For 24 = 2³ × 3, 36 = 2² × 3² and 60 = 2² × 3 × 5: HCF = 2² × 3 = 12 and LCM = 2³ × 3² × 5 = 360.

2. Division (ladder) method

Write the numbers in a row and divide by a prime that goes into at least one of them, bringing down any number it doesn't divide. Keep going until every number is 1; the LCM is the product of the primes on the left. For the HCF, divide only by primes that go into every number; stop when no prime divides them all, and multiply the primes you used.

3. Euclid's division algorithm

Divide the larger number by the smaller and keep the remainder: a = b × q + r. Then divide b by r, and so on. When the remainder is 0, the last divisor is the HCF. NCERT's example, 4052 and 12576, takes seven divisions: 12576 = 4052 × 3 + 420, 4052 = 420 × 9 + 272, … 24 = 4 × 6 + 0, so the HCF is 4. With the HCF of two numbers, LCM = a × b ÷ HCF = 4052 × 12576 ÷ 4 = 12,739,488.

4. Listing factors and multiples

For small numbers, write out each list. Multiples of 6: 6, 12, 18, 24, 30, 36, 42; of 7: 7, 14, 21, 28, 35, 42; of 21: 21, 42. The first number in every list, 42, is the LCM. Factors work the same way for the HCF: the biggest number in every factor list. The calculator shows the lists when they are short enough to read (up to 20 multiples per number, and factors of numbers up to 10,000).

Worked example: 12 and 18

12 = 2² × 3 and 18 = 2 × 3², so the HCF is 2 × 3 = 6 and the LCM is 2² × 3² = 36. Check: 6 × 36 = 216 = 12 × 18. The common factors are the factors of the HCF: 1, 2, 3 and 6. The common multiples are the multiples of the LCM: 36, 72, 108 and so on.

Where you use LCM and HCF

  • Adding fractions: the LCM of the denominators is the lowest common denominator, so 1/12 + 1/18 = 3/36 + 2/36 = 5/36.
  • Simplifying fractions: divide the top and bottom by their HCF: 18/24 ÷ 6 = 3/4.
  • Things that repeat: two bells ringing every 12 and 18 minutes ring together every 36 minutes (the LCM).
  • Equal groups: the largest tile that fits a 240 cm × 360 cm floor with no cutting is 120 cm square (the HCF).

The calculator uses exact whole-number arithmetic, so the LCM of large numbers keeps every digit. Methods follow NCERT Class 10 Mathematics, chapter 1 (Real Numbers).

Frequently asked questions

What is the difference between LCM and HCF?

The HCF (highest common factor, also called the GCD or GCF) is the biggest number that divides all of your numbers exactly. The LCM (least common multiple) is the smallest number that all of your numbers divide into exactly. For 12 and 18 the HCF is 6 and the LCM is 36. The HCF can't be bigger than the smallest number, and the LCM can't be smaller than the largest.

Is HCF × LCM always equal to the product of the numbers?

Only for two numbers. For 12 and 18: 6 × 36 = 216 = 12 × 18. For three or more numbers it usually fails: the HCF of 6, 72 and 120 is 6 and the LCM is 360, and 6 × 360 = 2,160, while 6 × 72 × 120 = 51,840. The calculator shows the check only when you enter two numbers.

How do I find the HCF and LCM of fractions?

Put each fraction in lowest terms first. Then HCF = HCF of the numerators ÷ LCM of the denominators, and LCM = LCM of the numerators ÷ HCF of the denominators. For 2/3, 8/9, 16/81 and 10/27 that gives an HCF of 2/81 and an LCM of 80/3. Type the fractions with a slash and the calculator shows each step.

How do I find the HCF of decimals like 0.6, 9.6 and 0.36?

The textbook way is to give every number the same number of decimal places (0.60, 9.60, 0.36), find the HCF of 60, 960 and 36, which is 12, and put the decimal point back: 0.12. The calculator turns each decimal into a fraction instead (0.6 = 3/5), which gives the same answer and also works for the LCM.

Which method should I write in an exam?

Use the one your question asks for. Prime factorisation is the usual Class 6–10 method and the easiest to check. The division (ladder) method is quicker for three or more numbers. Euclid's division algorithm is what NCERT Class 10 asks for when a question says 'use Euclid's algorithm', and it is the fastest for large numbers that are hard to factorise.

What does co-prime mean?

Two or more numbers are co-prime when their HCF is 1, so they share no factor except 1, like 8 and 15. Their LCM is then their product: 8 × 15 = 120. Co-prime numbers don't have to be prime themselves.

More everyday calculators

See all everyday calculators →

Can't find the tool you need? Tell us, and the most requested tools get built first.