MATHS & STATISTICS / NUMBER THEORY

GCF and LCM calculator

Find the greatest common factor (highest common factor) and least common multiple of two or three whole numbers, calculated exactly.

Last reviewed:

← All tools

Your numbers

Leave at 0 to use only the first two numbers.
◈ Your values stay in your browser. No account needed.
YOUR RESULT

Enter your numbers to see a result.

WORKED EXAMPLE

GCF and LCM calculator: a worked example

With first number 24, second number 36, third number (optional) 0, the greatest common factor (gcf) is 12.

Inputs
First number24
Second number36
Third number (optional)0
Results
Greatest common factor (GCF)12
Least common multiple (LCM)72
RelationshipNot coprime: they share a factor greater than 1
THE METHOD

How it works

The greatest common factor (also called the highest common factor or greatest common divisor) is the largest whole number that divides all the numbers exactly. The least common multiple is the smallest number that all of them divide into. Euclid's algorithm finds the GCF quickly even for very large numbers, and all arithmetic is done with exact integers.

FormulaGCF by Euclid's algorithm: gcd(a, b) = gcd(b, a mod b) until the remainder is 0. LCM(a, b) = a ÷ GCF(a, b) × b.
ASSUMPTIONS

Assumptions and limits

  • Inputs are positive whole numbers up to one million million.
  • A third value of 0 means it is not used.
  • An LCM longer than 30 digits is shown rounded to six significant figures and marked as approximate.
  • Results are estimates based on the inputs and assumptions on this page, not professional advice.
  • Try this: use “Save scenario A”, change one input and compare the two results side by side.
QUESTIONS

Frequently asked questions

How is the result of the “GCF and LCM calculator” calculated?

GCF by Euclid's algorithm: gcd(a, b) = gcd(b, a mod b) until the remainder is 0. LCM(a, b) = a ÷ GCF(a, b) × b. The greatest common factor (also called the highest common factor or greatest common divisor) is the largest whole number that divides all the numbers exactly. The least common multiple is the smallest number that all of them divide into. Euclid's algorithm finds the GCF quickly even for very large numbers, and all arithmetic is done with exact integers.

What does the worked example show?

With first number 24, second number 36, third number (optional) 0, the greatest common factor (gcf) is 12. Least common multiple (LCM): 72; Relationship: Not coprime: they share a factor greater than 1.

What assumptions and limits apply?

This is an estimate based on the inputs and assumptions shown on this page, not professional advice. Check anything with financial, health or safety consequences independently.

Is my data private?

Yes. Calculations run in your browser and your numbers are not sent to a server. A share link contains the inputs you choose to share, so check it before sending it to anyone.

What is the GCF of 24 and 36?

12. The factors of 24 are 1, 2, 3, 4, 6, 8, 12 and 24; the factors of 36 are 1, 2, 3, 4, 6, 9, 12, 18 and 36. The largest one they share is 12. Their LCM is 72.

How are GCF and LCM connected?

For two numbers, GCF × LCM = a × b. With 24 and 36, 12 × 72 = 864 = 24 × 36. That is why the LCM can be found by dividing the product by the GCF.

When do I use the LCM?

To add fractions with different denominators (the LCM is the lowest common denominator) and to find when repeating events line up, such as buses every 12 and 18 minutes meeting every 36 minutes.

FOR WEBSITE OWNERS

Embed this calculator on your site

Free to use. Paste this where you want the calculator to appear. It resizes itself and links back to Calculator786.