Math Solver Free

LCM and HCF Calculator

Least common multiple and highest common factor — with every step shown.

LCM
72
HCF (GCD)
6

Step 1: Find GCD of 18 and 12 using the Euclidean algorithm:

Step 2: 18 = 12 × 1 + 6

Step 3: 12 = 6 × 2 + 0

Step 4: Last non-zero remainder = 6, so GCD(12, 18) = 6.

LCM: (12 × 18 × 24) ÷ 6 = 72

Prime Factorization

12 = 2^2 × 3

12 ÷ 2 = 6

6 ÷ 2 = 3

18 = 2 × 3^2

18 ÷ 2 = 9

9 ÷ 3 = 3

3 ÷ 3 = 1

24 = 2^3 × 3

24 ÷ 2 = 12

12 ÷ 2 = 6

6 ÷ 2 = 3

How to Find LCM and HCF

The highest common factor (HCF), also called the greatest common divisor (GCD), is the biggest number that divides every number in your set exactly, with nothing left over. The least common multiple (LCM) runs in the opposite direction: it is the smallest number that every number in your set divides into exactly. One looks downward for a shared divisor, the other upward for a shared multiple, and together they quietly power fraction arithmetic, scheduling, and fair sharing. This calculator finds both for two or more whole numbers at once, and — just as usefully — shows the Euclidean algorithm steps and a full prime factorization of every number, so the method is visible rather than magic.

The Definitions, Symbol by Symbol

In the notation HCF(a, b) and LCM(a, b), the letters a and b simply stand for any two whole numbers in your set. Their prime factorizations are written with powers such as 2³, where the base is a prime number and the exponent counts how many times that prime appears as a factor. The HCF is built by taking, for each prime appearing in both numbers, the lowest of the two powers; the LCM is built by taking, for each prime appearing in either number, the highest power. For exactly two numbers the two answers are linked by the identity LCM(a, b) × HCF(a, b) = a × b — so each answer can be checked against the other, and if you know one, the other is a single division away.

Two Reliable Methods

  • Prime factorization: break each number into primes; the HCF takes the lowest power of each shared prime, the LCM takes the highest power of every prime present.
  • Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller — the fastest route to the HCF, shown step by step above.

How to Use This Calculator

  1. Type your numbers into the single input field, separated by commas or spaces — the field starts with 12, 18, 24, and you can enter as few as two numbers or as many as you like.
  2. Watch the result panel, which updates as you type: your LCM appears on the left in green and your HCF (GCD) on the right, both in large type.
  3. Read the Euclidean steps listed under the results, which show the algorithm working on your first pair of numbers, followed by the line that derives the LCM from your numbers and their HCF.
  4. Scroll to the Prime Factorization panel to see each of your first six numbers broken into primes with every division step — the working you would show in an exam.

Worked Example 1: LCM and HCF of 12 and 18

  1. Factor both numbers: 12 = 2² × 3 and 18 = 2 × 3².
  2. HCF: take the lowest power of each shared prime: 2¹ × 3¹ = 6.
  3. LCM: take the highest power of every prime present: 2² × 3² = 36.
  4. Identity check: LCM × HCF = 36 × 6 = 216, and 12 × 18 = 216. ✓

Cross-check the HCF by Euclid's method, as the calculator displays: 18 = 12 × 1 + 6, then 12 = 6 × 2 + 0, so the last non-zero remainder is 6 — the same HCF the factorization gave. Two independent methods agreeing is what a correct answer looks like.

Worked Example 2: LCM and HCF of 24 and 36

Factor each number down to primes. 24 = 2 × 2 × 2 × 3 = 2³ × 3. 36 = 2 × 2 × 3 × 3 = 2² × 3². For the HCF, take the lower power of each shared prime: 2² (the smaller of 2³ and 2²) and 3¹ (the smaller of 3¹ and 3²), giving 2² × 3 = 4 × 3 = 12. For the LCM, take the higher power of each prime: 2³ and 3², giving 8 × 9 = 72. Now run the identity check: LCM × HCF = 72 × 12 = 864, and the original numbers multiply to 24 × 36 = 864 — the two sides match, so both answers are consistent. Euclid confirms the HCF independently: 36 = 24 × 1 + 12, then 24 = 12 × 2 + 0, ending at 12.

Where They Show Up

Adding fractions with unlike denominators needs the LCM: sixths and eighths only combine once both are rewritten over the LCM 24. Simplifying a fraction needs the HCF of numerator and denominator — 24/36 collapses to 2/3 precisely because their HCF is 12, as the example above shows. Scheduling problems are LCM problems in disguise: buses leaving every 12 and every 18 minutes depart together every 36 minutes. Sharing and tiling run on the HCF: the largest equal groups with nothing left over, or the biggest square tile that fits a floor exactly, are both HCF answers.

Three Mistakes to Watch For

First, swapping the power rules: taking the highest powers for the HCF or the lowest for the LCM produces each other's answer — remember the HCF is the smaller result and can never exceed the smallest number you entered. Second, applying the identity LCM × HCF = a × b to three or more numbers: it is a two-number theorem, and for three numbers the calculator's pairwise method is the correct route. Third, stopping a factorization too early — writing 24 = 4 × 6 and treating 4 and 6 as if they were primes, or listing 1 among the prime factors. Every branch of the factor tree must end in a prime.

Simplifying a fraction with these results? Try our fraction calculator or the four-function calculator. Working under the American name for the same number? Our GCF calculator finds the greatest common factor — identical to the HCF — with the full list of common factors.

Frequently Asked Questions

What is the LCM and HCF of 12 and 18?

Factor both: 12 = 2² × 3 and 18 = 2 × 3². The HCF takes the lowest shared powers: 2 × 3 = 6. The LCM takes the highest powers: 2² × 3² = 36. Check with the identity: 36 × 6 = 216 = 12 × 18. ✓ In words: 6 is the largest divisor the two numbers share, and 36 is the smallest multiple they share.

How are LCM and HCF related?

For any two numbers, LCM(a, b) × HCF(a, b) = a × b, always. That makes the identity both a shortcut and a checker: if you know the HCF of 12 and 18 is 6, the LCM must be (12 × 18) ÷ 6 = 36, and if your two answers do not multiply to 216, one of them is wrong. Note the identity holds for two numbers only, not three or more.

What is the difference between LCM and HCF?

The HCF (highest common factor, also called GCD) is the largest number that divides all the given numbers exactly. The LCM (least common multiple) is the smallest number that all the given numbers divide into exactly. For 12 and 18, the HCF is 6 and the LCM is 36.

How do you find the LCM and HCF of three numbers?

Work pairwise: find the GCD of the first two numbers, then the GCD of that result with the third number. For the LCM, use LCM(a, b, c) = LCM(LCM(a, b), c). This calculator handles any count of numbers automatically — just type all of them into the input box, separated by commas or spaces, and read off both results.

What is the Euclidean algorithm?

It is the fastest way to find a GCD: divide the larger number by the smaller, replace the larger with the remainder, and repeat until the remainder is zero. The last non-zero remainder is the GCD. The calculator shows each division step.

Is this LCM and HCF calculator free?

Yes — every tool on Math Solver Free is free with no sign-up, and all calculations run in your browser. Type two or more whole numbers separated by commas and the calculator instantly shows their LCM and HCF with the Euclidean algorithm steps and a prime factorization of each number, so you can follow the method as well as the answer.

Related Tools & Guides

About the MathSolverFree Team

The MathSolverFree Team builds and maintains the calculators and step-by-step solvers on this site. Every tool is checked against worked textbook examples before it is published, and the method behind each solver is written out in full — in the worked examples on the page and in our guides — so you can see exactly how an answer is reached, not just the answer itself.

How we build and test our tools·More about the team