GCF and LCM Calculator: Greatest Common Factor, Least Common Multiple and Prime Factorisation

Greatest common factor, least common multiple and prime factors.

Calculated from standard textbook formulas, with every step shown. The formulas are fixed, so the working does not need checking: what matters is the numbers you type in. Use these calculators only if you are competent to choose the inputs (loads, material strength, dimensions, supports) and check your units and assumptions. For learning and checking your own working: design and sign-off are for a qualified engineer. Drafting Central does not store the numbers you type.

How this calculator works

Choose how many numbers and enter them.

The calculator finds the GCF with the Euclidean algorithm.

It gives the LCM and the prime factors of each number.

Formulas used

  • \gcd(a, b) = \gcd(b, a \bmod b)
  • \operatorname{lcm}(a, b) = \frac{ab}{\gcd(a, b)}

Worked example

With the default numbers in the calculator above:

  1. Greatest common factor (GCF): 12
  2. Least common multiple (LCM): 5040
  3. Prime factors of 48: 2^4 x 3
  4. Prime factors of 180: 2^2 x 3^2 x 5
  5. Prime factors of 84: 2^2 x 3 x 7

Change the numbers in the calculator to see the full working, every step, for your own case.

Common questions

What is the GCF?

The largest whole number that divides all the numbers exactly. It is also called the highest common factor or greatest common divisor.

What is the LCM?

The smallest number that all the numbers divide into exactly.

How do I find them from prime factors?

The GCF takes each prime the fewest times it appears, and the LCM takes each prime the most times it appears.

Related calculators

Got a question about this? Ask an engineering question and get a plain-language answer with references.

Further reading: Any number theory or arithmetic text (the Euclidean algorithm).

Need a calculator we do not have?

Tell us what you would like to calculate. We read every request and build the most asked-for ones.

We store your request (and your email if you give it) to decide what to build. We do not store the numbers you type into calculators.

Embed this calculator on your own page

Copy this code into your page. The calculator runs inside the frame and links back to Drafting Central.

Need this drawn, designed or checked?

Drafting Central is a mechanical engineering and drafting business working with customers across Australia and around the world. A calculator gives you the numbers; we can turn them into drawings and designs.

Need help with a real project?

Talk to Drafting Central →

← All engineering calculators