Home / LCM & GCF Calculator

LCM & GCF Calculator

Find the lowest common multiple (LCM) and greatest common factor (GCF or HCF) of two or more numbers, with prime factorisation and every step shown.

Calculated on your device
Separate them with commas or spaces, such as 12, 18, 30. Don't use thousands separators.
Embed this calculator on your website

Free to use on your blog or business site. Copy this code and paste it into your page's HTML.

Works in WordPress (Custom HTML block), Wix (Embed code), Squarespace (Code block), Webflow and Shopify pages.

How to use the LCM and GCF calculator

Type two or more whole numbers, up to 20, separated by commas or spaces. You get the greatest common factor (GCF, also called HCF or GCD), the lowest common multiple (LCM) and the prime factors of each number, with the working.

How it works

GCF = product of the shared primes, each to its lowest power
LCM = product of all the primes, each to its highest power
For two numbers: GCF × LCM = a × b

Worked example

12, 18 and 30: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5.

GCF = 2 × 3 = 6 (2 and 3 are in all three, each at least once). LCM = 2² × 3² × 5 = 180.

Where you'll use them

  • LCM: the lowest common denominator when adding fractions, or when two repeating events next line up.
  • GCF: simplifying fractions and ratios, or splitting things into the largest equal groups.

Try them in action with the fraction calculator and the ratio calculator.

Frequently asked questions

Is GCF the same as HCF?

Yes. Greatest common factor (GCF), highest common factor (HCF) and greatest common divisor (GCD) are three names for the same thing.

What if the GCF is 1?

Then the numbers are coprime: they have no common factor except 1, and the LCM of two such numbers is simply their product.

Formulas checked 29 October 2026. How we test our calculators. Check important results, and show your own working where your teacher or exam asks for it.