Skip to main content

LCM and GCD Calculator

The LCM and GCD are foundational concepts in number theory, used in fraction arithmetic, scheduling, and cryptography.

Calculated Result
36

LCM

Least common multiple (LCM)

36

Greatest common divisor (GCD)

6

Product

216

LCM × GCD

216

36 — LCM

Calculation Breakdown

  1. GCD by Euclid’s algorithmgcd(12, 18) = 6
  2. LCM from the GCDlcm = a·b / gcd = 216 / 6 = 36

LCM vs GCD (Example: 12 and 18)

Interactive visualization based on your current inputs

Calculated Value
0.09.0182736a = 12b = 18GCD = 6LCM = 36

What Is the LCM and GCD Calculator?

GCD is the largest number that divides both a and b without remainder. LCM is the smallest number divisible by both.

How Does the LCM and GCD Calculator Work?

Euclid's algorithm computes GCD by repeated division. LCM = a × b / GCD.

LCM and GCD Calculator Formula & Variables

The core mathematical equation utilized by this calculator is expressed as:

lcm(a,b)=a⋅bgcd⁡(a,b)\text{lcm}(a,b) = \dfrac{a \cdot b}{\gcd(a,b)}

The GCD (greatest common divisor) is found by repeatedly replacing the larger number with the remainder. The LCM follows from the identity LCM × GCD = a × b.

How to Use the LCM and GCD Calculator

  1. Enter two positive integers and the calculator returns both GCD and LCM with steps.

Step-by-Step Example Calculation

GCD and LCM of 12 and 18

Input Values:

a:12
b:18
Worked Steps: GCD(12, 18) = 6 and LCM(12, 18) = 36.

Understanding Your Result

GCD tells you the largest common factor for simplifying fractions. LCM tells you when two repeating events coincide.

Factors That Affect the Result

  • Coprime numbers (sharing no common factor) have GCD = 1 and LCM = a × b.

When Should You Use This Calculator?

  • Simplifying fractions, finding common denominators, scheduling recurring events.

Assumptions & Limitations

  • Inputs must be positive integers up to 1 trillion.

Frequently Asked Questions

Calculation Accuracy & Reference Note

Uses the classical Euclidean algorithm, which is exact for integers.

\n

Explore more tools and calculators in Math Calculators