InfyCalculator

GCF and LCM Calculator

Find the greatest common factor and least common multiple of two whole numbers.

First number
Second number
Loading calculator…

How it works

GCF by Euclid’s algorithm · LCM = a × b ÷ GCF

The GCF (also called GCD or HCF) is the largest number dividing both inputs; Euclid’s algorithm finds it by repeatedly replacing the larger number with the remainder of the division. The LCM is the smallest number both divide into, and the two are linked: GCF × LCM always equals the product of the original numbers.

Worked example

For 24 and 36: 36 ÷ 24 leaves remainder 12, and 24 ÷ 12 leaves remainder 0, so GCF = 12. Then LCM = 24 × 36 ÷ 12 = 72. Check: 12 × 72 = 864 = 24 × 36.

Frequently asked questions

What are GCF and LCM actually used for?

GCF simplifies fractions and splits things into equal groups; LCM finds common denominators and answers "when do two repeating events line up again" — two buses every 24 and 36 minutes meet every 72.

What if the two numbers share no factors?

Then they are coprime: the GCF is 1 and the LCM is simply their product. For example, 8 and 15 give GCF 1 and LCM 120.

Can I do more than two numbers?

Yes, fold the results in: GCF(a, b, c) = GCF(GCF(a, b), c), and the same chaining works for LCM. Run this calculator twice, feeding the first answer back in.

Related calculators

This calculator is for educational purposes. Double-check important results before acting on them.