HisabCalc

GCD and LCM Calculator

Finds the greatest common divisor and the least common multiple of two positive integers such as 84 and 126 using Euclid's algorithm.

Enter your numbers

Example: 84

Example: 126

Result
Share on WhatsApp

Figures are computed on your device; nothing is sent anywhere.

Formula

gcd(a, b) by Euclid's algorithm; lcm(a, b) = a * b / gcd(a, b)

How the calculation works

Euclid's algorithm finds the GCD by repeatedly replacing the larger number with the remainder of dividing it by the smaller one until that remainder becomes zero.

Once the GCD is known, the least common multiple follows from the identity lcm(a, b) = a * b / gcd(a, b), so no separate factorisation of the two numbers is required.

For the defaults a = 84 and b = 126 the GCD is 42, and dividing the product 84 * 126 = 10584 by 42 gives the LCM of 252.

Common mistakes

When to use it

Worked example

For a = 84 and b = 126, the GCD is 42 and the LCM is 252, because 42 is the largest number that divides both 84 and 126 exactly.

GCD 42.00
LCM 252.00

Common questions

What is the difference between the GCD and the LCM?

The GCD is the largest number that divides both inputs evenly, while the LCM is the smallest number that both inputs divide evenly. For 84 and 126 they are 42 and 252.

Why must the inputs be positive integers?

Euclid's algorithm depends on whole-number remainders, so decimals, zero and negative values are rejected before the calculation begins.

Last updated: 2026-10-03