Everyday utilities

GCD and LCM Calculator

GCD and LCM Calculator

Greatest common divisor (HCF) and least common multiple of two or more numbers, with Euclid's steps.

About this tool

About GCD and LCM Calculator

The greatest common divisor (GCD, also called HCF or GCF) is the largest number that divides all your numbers exactly; the least common multiple (LCM) is the smallest number they all divide into. You need the first to simplify fractions and ratios and the second to add fractions or line up repeating schedules. Enter two or more whole numbers and the calculator returns both, says whether the numbers are coprime, and for a pair confirms that GCD × LCM equals the product. Below that, a table writes out Euclid's algorithm one division at a time, the method teachers expect you to show, and for numbers of a practical size it lists each one's prime factorization too. It uses exact big-integer arithmetic for numbers up to 30 digits, accepts negative values, and does all the work inside your browser.

Built and maintained by Abhi JainUpdated

How to Find the GCD and LCM

  1. 1

    Enter numbers

    Type two or more whole numbers into Numbers, separated by commas or spaces.

  2. 2

    Read GCD and LCM

    The greatest common divisor appears at the top with the LCM underneath.

  3. 3

    Follow the steps

    Use the Euclid's algorithm table to see or copy the working, and download it as CSV if needed.

GCD and LCM Calculator: questions and answers

How does Euclid's algorithm find the GCD?

Divide the larger number by the smaller and keep the remainder, then repeat with the divisor and the remainder until the remainder is 0. The last non-zero remainder is the GCD. For 252 and 105: 252 = 2 × 105 + 42, 105 = 2 × 42 + 21, 42 = 2 × 21 + 0, so the GCD is 21.

How do you find the LCM from the GCD?

LCM(a, b) = |a × b| ÷ GCD(a, b). For 252 and 105: 26,460 ÷ 21 = 1,260.

Are HCF, GCF and GCD the same?

Yes. Highest common factor, greatest common factor and greatest common divisor are three names for the same number.

What does coprime mean?

Two numbers are coprime when their GCD is 1, such as 8 and 15. Their LCM is then simply their product.

How is the GCD used with fractions?

Divide the numerator and denominator by their GCD to simplify. The Fraction Calculator does this automatically.