Skip to main content

GCD & LCM Calculator

Enter two numbers to find their Greatest Common Divisor (GCD) and Least Common Multiple (LCM) instantly.

Ad (leaderboard)
G

Find GCD & LCM

GCD × LCM = a × b

Results

GCD
LCM
Rate this tool
0.0 / 5 · 0 ratings

Embed This Calculator

Add this calculator to your website for free. Copy the single line of code below and paste it into your HTML. The calculator auto-resizes to fit your page.

<script src="https://calchammer.com/embed.js" data-calculator="gcd-lcm-calculator" data-category="math"></script>
data-theme "light", "dark", or "auto"
data-values Pre-fill inputs, e.g. "amount=1000"
data-max-width Max width, e.g. "600px"
data-border "true" or "false"
Or use an iframe instead
<iframe src="https://calchammer.com/embed/math/gcd-lcm-calculator" width="100%" height="500" style="border:none;border-radius:12px;" title="Gcd Lcm Calculator"></iframe>

Preview

yoursite.com/blog
Gcd Lcm Calculator auto-resizes here
Ad (in_results)

How to Use the GCD & LCM Calculator

Enter two positive integers into the input fields, and the calculator instantly displays both the Greatest Common Divisor (GCD) and the Least Common Multiple (LCM). Results update in real time as you type, with no button to press or page to reload. Use this tool whenever you need to simplify fractions, find common denominators, or solve number theory problems.

The GCD and LCM are fundamental concepts in arithmetic and number theory. They appear in fraction operations, ratio simplification, scheduling problems, and even cryptography. Understanding how they relate to each other gives you a powerful toolkit for working with whole numbers efficiently.

Ad (in_content)

How GCD and LCM Are Calculated

The most efficient way to find the GCD is the Euclidean algorithm, which dates back over 2,000 years. It works by repeatedly replacing the larger number with the remainder of dividing the two numbers until one of them reaches zero. The last non-zero value is the GCD. For example, to find GCD(48, 18): 48 mod 18 = 12, then 18 mod 12 = 6, then 12 mod 6 = 0, so GCD = 6.

Once you know the GCD, the LCM is calculated using the relationship LCM(a, b) = (a × b) / GCD(a, b). Using the same example: LCM(48, 18) = (48 × 18) / 6 = 144. This formula is far more efficient than listing multiples of both numbers.

Why GCD and LCM Matter

The GCD is essential for simplifying fractions. Dividing both the numerator and denominator by their GCD produces the fraction in its lowest terms. The LCM is essential for adding and subtracting fractions because it gives you the least common denominator. Beyond fractions, the LCM helps synchronise repeating events. If one bus arrives every 12 minutes and another every 18 minutes, they will both arrive together every LCM(12, 18) = 36 minutes.

Real-World Applications

Carpenters use the GCD to cut boards into the largest equal pieces without waste. Event planners use the LCM to find when two recurring events coincide. Programmers use the GCD in cryptographic algorithms like RSA, where working with coprime numbers is critical. In music theory, the LCM determines when two rhythmic patterns played simultaneously will realign to their starting position.

Frequently Asked Questions

What is the Greatest Common Divisor (GCD)?

The GCD of two numbers is the largest positive integer that divides both numbers without leaving a remainder. For example, the GCD of 12 and 18 is 6 because 6 is the largest number that divides evenly into both 12 and 18. The GCD is also called the Greatest Common Factor (GCF) or Highest Common Factor (HCF).

What is the Least Common Multiple (LCM)?

The LCM of two numbers is the smallest positive integer that is a multiple of both numbers. For example, the LCM of 4 and 6 is 12 because 12 is the first number that appears in both the multiples of 4 and the multiples of 6.

How are GCD and LCM related?

The GCD and LCM of two numbers a and b are related by the formula: GCD(a, b) × LCM(a, b) = a × b. This means if you know one, you can calculate the other.

How do you calculate GCD using the Euclidean algorithm?

The Euclidean algorithm finds the GCD by repeatedly dividing the larger number by the smaller one and replacing the larger with the remainder. Continue until the remainder is zero. The last non-zero remainder is the GCD. For example: GCD(48, 18) proceeds 48 → 12 → 6 → 0, so GCD = 6.

When do you use GCD and LCM in real life?

GCD is used to simplify fractions, distribute items into equal groups, and tile floors with the largest possible square tile. LCM is used to find common denominators when adding fractions, schedule recurring events, and synchronise cycles like gear rotations or traffic lights.

Related Calculators

Disclaimer: This calculator is for informational and educational purposes only. Results are estimates and should not be considered professional expert advice. Consult a qualified professional before making decisions based on these calculations. See our full Disclaimer.