Find the GCD and LCM of two or more numbers, with prime factors and Euclid's steps alongside.
What you type is processed but never shared with anyone.
No sign-up, no fees.
GCD and LCM calculation: two or more numbers.
Broken down into prime factors.
The steps of the Euclidean algorithm for two numbers.
Full precision, numbers up to 30 digits.
What you type is processed, but never shared with anyone.
How to use the GCD LCM Calculator
Need to equalize denominators to add fractions? Four steps:
Type the numbers. Type the numbers in the Numbers box separated by commas, spaces or one under another. At least two, at most twenty numbers.
Read the result. The GCD (greatest common divisor) and LCM (least common multiple) come out right away.
Look at the factors. In the Prime factors section each number's prime factorization is shown.
Examine the steps. If you entered two numbers, the Euclidean algorithm steps show too.
What are GCD and LCM?
The GCD (greatest common divisor, also called the greatest common factor) is the largest number that divides all the numbers with no remainder: for 12 and 18 it's 6. The LCM (least common multiple) is the smallest number that is a multiple of all of them: for 12 and 18 it's 36. At school we meet them most with fractions, divisibility questions and word problems: "What's the largest side length we can cut a field into equal squares with?" is a GCD question; "When will two buses leave at the same time again?" is an LCM question.
For two numbers this relation always holds: GCD × LCM = the product of the two numbers (6 × 36 = 12 × 18).
The Euclidean algorithm
The old, fast way of finding the GCD: divide the larger number by the smaller and take the remainder; then divide the smaller number by the remainder. When the remainder is zero, the last divisor is the GCD. For 48 and 18: 48 = 2 × 18 + 12, 18 = 1 × 12 + 6, 12 = 2 × 6 + 0; the GCD is 6. When you enter two numbers, the tool shows you these steps.
Prime factorization
Every number can be written as a product of primes: 36 = 2² × 3². The product of the common prime factors with their smallest exponents gives the GCD, and the product of all prime factors with their largest exponents gives the LCM. The tool lists the factors separately.
Limits
Numbers must be positive whole numbers. Zero, negatives and decimals aren't accepted.
Numbers can be 30 digits at most and are calculated with full precision.
Prime factorization is done up to 1,000,000,000,000 (10¹²). For bigger numbers the GCD and LCM are still found, only the factorization is skipped.
Tips for the greatest common divisor and common multiple
When adding fractions: the LCM of the denominators is the smallest choice for a common denominator.
When reducing fractions: if you divide the numerator and denominator by the GCD, the fraction reduces in one step; to turn decimals into fractions use Decimal ↔ fraction.
More than three numbers: type the numbers one after another; the GCD and LCM are found for all of them together.
Common mistakes
Mixing up GCD and LCM: the GCD is less than or equal to the numbers, the LCM greater than or equal.
Entering a negative or zero: only positive whole numbers are accepted.
The calculation happens in your browser. What you type is processed, but never shared with anyone.
The GCD came out 1. What does that mean?
The numbers are coprime; they have no common divisor other than 1.
Is GCD the same as HCF?
Yes, two names for the same thing: greatest common divisor and highest common factor.
How is the GCD found?
Break the numbers into prime factors and multiply the common factors with the smallest exponent. Or use the Euclidean algorithm; the tool shows the steps.
How is the LCM found?
Multiply all the prime factors with their largest exponent. For two numbers, LCM = product / GCD.
How many numbers can I enter?
Twenty at most.
Can I use it on my phone?
Yes. Type the numbers; the results show right below.
Everyday examples of GCD and LCM
GCD: splitting 24 and 36 students into groups with the same number in each and as many students as possible per group (GCD 12).
LCM: two buses leaving every 6 minutes and every 8 minutes leaving together again (LCM 24 minutes).
Fractions: to add 1/6 and 1/8, the common denominator is 24.
I want to try GCD and LCM by hand. How do I check?
Break the two numbers into prime factors, mark the common ones, then compare your own result with the factor list next to the tool.