Przejdź do treści
Liczbnik
Current for 2026Methodology

GCD and LCM Calculator

Enter two positive integers — the calculator returns GCD and LCM using the Euclidean algorithm.

Na tej stronie

How we calculate

GCD uses the Euclidean algorithm: GCD(a, b) = GCD(b, a mod b). LCM = |a × b| / GCD(a, b).

Example: GCD(12, 8)

GCD(12, 8) = 4. LCM(12, 8) = 12×8/4 = 24.

Frequently asked questions

What is GCD?

Greatest Common Divisor — the largest integer that divides both numbers without a remainder.

What is LCM?

Least Common Multiple — the smallest positive integer that is divisible by both numbers.

How is GCD used in fractions?

GCD is used to simplify fractions: divide both numerator and denominator by GCD.

LCM gives the common denominator needed for adding or subtracting fractions.

An efficient method: GCD(a,b) = GCD(b, a mod b). Repeat until b=0, then a is the GCD.

If GCD(a,b) = 1, the numbers are coprime (no common factors except 1).

Yes: GCD(a,b,c) = GCD(GCD(a,b), c). Apply iteratively.

Yes, unless one number is a multiple of the other — then LCM equals the larger number.

By convention, GCD(0, n) = n. LCM(0, n) = 0.

Two numbers are coprime if their GCD equals 1. Example: 8 and 15 (GCD=1).

For educational purposes.

  • Fraction Calculator

    Calculate addition, subtraction, multiplication and division of fractions online. Result as simplified fraction and decimal. Free.