💰 Financial Calculators ❤️ Health & Fitness Calculators 📐 Math Calculators 🔄 Conversion Calculators 📊 Business Calculators 🏗️ Construction Calculators 📅 Date & Time Calculators 🎓 Education Calculators 🚗 Automotive Calculators 🧮 Everyday Calculators

GCD & LCM Calculator

Calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of up to 5 numbers, with prime factorization for each.

Quick Calculator Get a fast estimate
Results for: 12, 18
GCD = 6
LCM
36
GCD × LCM check
12 × 18 = 216
Prime Factorizations
122^2 × 3
182 × 3^2

How to Use

Enter 2 to 5 whole numbers. The calculator finds the GCD (also called HCF — Highest Common Factor) and LCM, showing the prime factorization of each number.

The Extended Calculator adds Euclidean algorithm steps, a Venn diagram of prime factors, and coprimality checking. The Professional Calculator includes the Extended Euclidean algorithm (Bezout's identity), multi-number GCD/LCM for up to 10 numbers, and Euler's totient function.

Need more detail?
📊 Extended Calculator More options, charts, and scenario comparison
GCD(48, 18)
6
Factors of 48
2 × 2 × 2 × 2 × 3
Factors of 18
2 × 3 × 3
Prime Factor Venn Diagram
4818GCD factors2 3
Euclidean Algorithm Steps
StepDivisionRemainder
148 = 2 × 18 + 1212
218 = 1 × 12 + 66
312 = 2 × 6 + 00
GCD6

GCD and LCM Formulas

GCD (Euclidean algorithm): gcd(a, b) = gcd(b, a mod b) until b = 0

LCM from GCD: lcm(a, b) = |a × b| / gcd(a, b)

GCD × LCM = a × b (for two numbers)

Bezout's Identity: There exist integers s, t such that gcd(a,b) = s·a + t·b

Worked Example

GCD and LCM of 12 and 18:

12 = 2² × 3  |  18 = 2 × 3²

GCD = 2 × 3 = 6

LCM = 2² × 3² = 36

Check: 6 × 36 = 216 = 12 × 18 ✓

Need full precision?
🔬 Professional Calculator Complete parameters, sensitivity analysis, and detailed breakdown
Find x, y such that: 252·x + 105·y = GCD(252,105)
Bezout's Identity
252·(-2) + 105·(5) = 21
GCD(252,105)
21
x (Bezout coefficient)
-2
y (Bezout coefficient)
5
Verification
21 = 21
Back-Substitution Steps
StepabQuotientRemainder
1252105242
210542221
3422120

Frequently Asked Questions

GCD is the largest number that divides all given numbers exactly. LCM is the smallest number that all given numbers divide into exactly. GCD simplifies fractions; LCM finds common denominators.
An efficient method to find the GCD. Repeatedly replace the larger number with the remainder: gcd(48, 18) → gcd(18, 12) → gcd(12, 6) → gcd(6, 0) = 6.
Adding or subtracting fractions with different denominators requires the LCM. To add 1/4 + 1/6, LCM(4, 6) = 12, so 3/12 + 2/12 = 5/12. LCM also finds when recurring events coincide.
Two numbers are co-prime if their GCD is 1 — they share no common factors other than 1. For example, 8 and 15 are co-prime. Co-prime numbers are fundamental in RSA encryption.

Related Calculators