# GCD and LCM Calculator

> Find the greatest common divisor (GCF) and least common multiple of two whole numbers, with the Euclidean algorithm steps counted.

- Live calculator: https://opuscalculator.com/calculators/gcd-lcm-calculator/
- Category: Math
- Last updated: 2026-11-22

## Inputs

| Input | Default | Allowed |
| --- | --- | --- |
| First number | 48 | 1 to 1000000000000000 |
| Second number | 18 | 1 to 1000000000000000 |

## Result with the default inputs

- Greatest common divisor: 6
- Least common multiple: 144
- Euclidean steps: 3

## How it is calculated

Euclid: gcd(a, b) = gcd(b, a mod b) until the remainder is zero. lcm(a, b) = a × b ÷ gcd(a, b).

## Worked example

gcd(48, 18): 48 = 2 × 18 + 12; 18 = 1 × 12 + 6; 12 = 2 × 6 + 0, so the gcd is 6 and the lcm is 48 × 18 ÷ 6 = 144.

## Frequently asked questions

### Is GCD the same as GCF or HCF?

Yes. Greatest common factor and highest common factor are other names for the greatest common divisor.

### What if the numbers share no factors?

The GCD is 1 and they are called coprime; the LCM is their product.

### How do I find the GCD of three numbers?

Take the GCD of the first two, then the GCD of that result with the third.

## Sources

- [10.6 Introduction to Factoring Polynomials (Prealgebra 2e)](https://openstax.org/books/prealgebra-2e/pages/10-6-introduction-to-factoring-polynomials), OpenStax, Rice University, checked 2026-11-29. The greatest common factor of numbers by prime factorization, with the example that the GCF of 24 and 36 is 12. The calculator uses the Euclidean algorithm, which this page does not describe; it gives the same result.
- [2.5 Prime Factorization and the Least Common Multiple (Prealgebra 2e)](https://openstax.org/books/prealgebra-2e/pages/2-5-prime-factorization-and-the-least-common-multiple), OpenStax, Rice University, checked 2026-11-29. The least common multiple by the prime factors method (find the prime factorizations, match primes in columns, bring down each column, multiply). The formula lcm = a x b / gcd is not stated on this page.

## Cite this page

- APA: Opus Calculator. (2026, November 22). GCD and LCM Calculator [Online calculator]. https://opuscalculator.com/calculators/gcd-lcm-calculator/
- Plain: GCD and LCM Calculator, Opus Calculator, https://opuscalculator.com/calculators/gcd-lcm-calculator/

Numbers on this page come from the same code as the live calculator, using exact decimal arithmetic. Source: Opus Calculator, https://opuscalculator.com/calculators/gcd-lcm-calculator/
