LCM / GCD Calculator

Enter two whole numbers. For example, 12 and 18 give GCD 6 and LCM 36.

Whole numbers only (1, 2, 3 …)

Whole numbers only (1, 2, 3 …)

Result

LCM 36 · GCD 6

GCD
6
LCM
36

GCD of 12 and 18 is 6; LCM is 36.

How this was calculated
  1. By Euclid, GCD(12, 18) = 6; LCM = 12 × 18 ÷ 6 = 36

How to use

  1. Enter two whole numbers.
  2. See the GCD and LCM together.

Formulas

What Formula Example
GCD Euclid’s method GCD(12, 18) = 6
LCM a × b ÷ GCD 12 × 18 ÷ 6 = 36
Check GCD × LCM = a × b 6 × 36 = 216 = 12 × 18

Euclid’s method, step by step

Divide the larger number by the smaller. If the remainder is 0, the divisor is the GCD. Otherwise make the old divisor the new dividend and the remainder the new divisor, and divide again. For 12 and 18: 18 ÷ 12 leaves remainder 6; then 12 ÷ 6 leaves 0. So the GCD is 6.

Examples

12 and 18: GCD 6, LCM 36.

5 and 7: both prime, so GCD 1 and LCM 35.

48 and 180: 180 ÷ 48 leaves 36; 48 ÷ 36 leaves 12; 36 ÷ 12 leaves 0. GCD 12, LCM = 48 ÷ 12 × 180 = 720.

84 and 126: 126 ÷ 84 leaves 42; 84 ÷ 42 leaves 0. GCD 42, LCM 252.

Adding 5/12 + 7/18: the LCM of 12 and 18 is 36. 5/12 = 15/36 and 7/18 = 14/36, so the sum is 29/36.

Simplifying 48/180: divide top and bottom by the GCD 12 to get 4/15.

Where it helps in real life

  • Events that coincide: two buses reach a stop every 12 and 18 minutes. If they arrive together now, they next arrive together after 36 minutes (the LCM).
  • Equal pieces: to cover a 12 ft × 18 ft floor with square tiles, the largest tile side is 6 ft (the GCD), which needs 2 × 3 = 6 tiles. If that size is not available, pick a smaller common divisor.

Common mistakes

  • Treating the product as the LCM. 12 × 18 = 216 is not the LCM. Divide the product by the GCD to get 36.
  • Mixing up the two. The GCD is never larger than the smaller number; the LCM is never smaller than the larger number. If your answer breaks this, something is off.
  • Entering decimals or fractions. The tool accepts only whole numbers of 1 or more. Zero and negatives give no result.
  • Matching denominators with the product alone. It works, but the numbers get bigger; using the LCM keeps the sum small.

For exam students

In Bangladeshi textbooks LCM and GCD are usually taught by prime factorisation or the division method. Use the calculator to check your answer, but write the steps in the exam. To verify a result, use GCD × LCM = a × b.

More: where they are used and why it works

LCM aligns denominators when adding fractions; GCD simplifies them. LCM also tells when repeating events coincide.

Seeing it through factors: 12 = 2 × 2 × 3 and 18 = 2 × 3 × 3. The common part is 2 × 3 = 6, the GCD. For the LCM, take each prime the maximum number of times it appears: 2 × 2 × 3 × 3 = 36.

Why Euclid’s method is practical: factorising big numbers is hard, but the remainder method finishes in a few steps. 84 and 126 need only two. The calculator uses this method, so large inputs give instant answers.

Special cases: equal numbers (9 and 9) give GCD 9 and LCM 9. If one number is 1, the GCD is 1 and the LCM is the other number. If the GCD is 1 the numbers are called coprime, like 15 and 28, and their LCM is the product, 420.

Frequently asked questions

What are LCM and GCD?

GCD is the largest number dividing both; LCM is the smallest multiple of both. For 12 and 18, GCD is 6 and LCM is 36.

What is the formula?

LCM = (a × b) ÷ GCD. GCD comes from Euclid's method with remainders.

Do fractions work?

No — enter positive whole numbers only.

What is the LCM of two primes?

For two primes the GCD is 1 and the LCM is their product. For 5 and 7: GCD 1, LCM 35.

How does GCD simplify a fraction?

Divide the numerator and denominator by the GCD. For 12/18 the GCD is 6, so it simplifies to 2/3.

How do I find the LCM or GCD of three numbers?

The calculator takes two numbers at a time. Work out the first two, then enter that result with the third. For 4, 6 and 10: LCM(4, 6) = 12, then LCM(12, 10) = 60.

What if one number is a multiple of the other?

The smaller number is the GCD and the larger is the LCM. For 6 and 24, GCD is 6 and LCM is 24.

Is GCD × LCM always equal to the product of the numbers?

For two numbers, yes. For 12 and 18: 6 × 36 = 216 = 12 × 18. The relation does not hold for three or more numbers.

What is HCF?

HCF (Highest Common Factor) is another name for GCD (Greatest Common Divisor). Bangla textbooks call it গ.সা.গু; LCM is ল.সা.গু.

Also searched as

lcm gcd finder · least common multiple