GCF and LCM Calculator
Find the greatest common factor and least common multiple of two or more whole numbers, with exact answers and worked steps.
Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.
About GCF and LCM Calculator
The greatest common factor (GCF) is the largest positive whole number that divides every number in a list without a remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF). This calculator accepts 2–20 whole numbers, up to 50 digits each, and uses exact integer arithmetic. The same numbers also give the least common multiple (LCM): the smallest positive whole number that every input divides evenly. The worked steps use repeated division rather than listing every factor, and show the pairwise LCM steps. All processing stays in your browser.
How GCF and LCM Calculator works
a = b × quotient + remainder Repeat with (b, remainder) until remainder = 0 GCF(a, b, c) = GCF(GCF(a, b), c) LCM(a, b) = a × b ÷ GCF(a, b) LCM(a, b, c) = LCM(LCM(a, b), c)
Start with the larger number. Divide by the smaller and keep the remainder. Continue until a division has no remainder; its divisor is the greatest common factor. Repeat with the next number for a longer list. A zero paired with a positive number leaves that positive number as the GCF. For the least common multiple, multiply two numbers and divide by their GCF, then repeat with the next number. Any list containing zero has LCM 0.
| Question | Working | Answer |
|---|---|---|
| What is the GCF of 12 and 18? | 18 = 12 × 1 + 6; 12 = 6 × 2 + 0 | 6 |
| What is the GCF of 18, 30 and 42? | GCF(18, 30) = 6; GCF(6, 42) = 6 | 6 |
| What is the GCF of 17 and 29? | 29 = 17 + 12; 17 = 12 + 5; 12 = 5 × 2 + 2; 5 = 2 × 2 + 1; 2 = 1 × 2 | 1 |
| What is the GCF of 0 and 18? | 18 divides itself and also divides 0 | 18 |
| What is the LCM of 12 and 18? | GCF(12, 18) = 6; 12 × 18 ÷ 6 = 216 ÷ 6 | 36 |
| What is the LCM of 18, 30 and 42? | LCM(18, 30) = 18 × 30 ÷ 6 = 90; LCM(90, 42) = 90 × 42 ÷ 6 | 630 |
When to use GCF and LCM Calculator
GCF and LCM Calculator FAQ
What is the GCF of 12 and 18?
It is 6: 12 ÷ 6 = 2 and 18 ÷ 6 = 3. No larger positive whole number divides both evenly. Dividing both parts of 12/18 by 6 gives 2/3.
Are GCF, GCD and HCF the same?
Yes. Greatest common factor, greatest common divisor and highest common factor refer to the same number. These names share this calculator; no separate input or mode is needed.
What is the LCM of 12 and 18?
It is 36, the smallest positive whole number that both 12 and 18 divide evenly (36 ÷ 12 = 3, 36 ÷ 18 = 2). The calculator finds it as 12 × 18 ÷ GCF(12, 18) = 216 ÷ 6 = 36.
How do I find the LCM of three or more numbers?
Combine them one at a time: find the LCM of the first pair, then the LCM of that answer and the next number. For 18, 30 and 42, LCM(18, 30) is 90 and LCM(90, 42) is 630. Both results appear together for the same list of numbers.
How are the GCF and LCM of two numbers related?
Multiplied together they equal the product of the two numbers: GCF(12, 18) × LCM(12, 18) = 6 × 36 = 216 = 12 × 18. This is why the LCM can be found from the GCF. It holds for two numbers, not for longer lists.
Can I find the GCF of three or more numbers?
Yes. Enter up to 20 numbers. First find the GCF of the first pair, then use that answer with the next number. For 18, 30 and 42, GCF(18, 30) is 6 and GCF(6, 42) is 6.
How do the worked steps find the GCF?
The Euclidean algorithm divides the larger number by the smaller, then repeats using the divisor and remainder. When the remainder reaches zero, the last nonzero divisor is the answer. For 18 and 30: 30 = 18 × 1 + 12, then 18 = 12 × 1 + 6, then 12 = 6 × 2 + 0. The GCF is 6.
What does a GCF of 1 mean?
Only 1 divides every number in the list. For two numbers this means they are relatively prime, also called coprime. For a longer list, a GCF of 1 does not mean every possible pair is coprime: 6, 10 and 15 have GCF 1, although each pair shares a larger factor.
Can I enter zero, negative numbers or decimals?
Zero is accepted alongside at least one positive whole number: GCF(0, 18) is 18. A list containing zero has LCM 0 here, because 0 is the only common multiple of zero and another number. If every value is zero, there is no greatest positive common factor, so this tool asks for a positive value. Negative numbers, signs, decimals, fractions and scientific notation are not accepted.
How do I enter a list or a large number?
Separate values with commas, spaces, semicolons or new lines. Commas always separate values, never thousands: enter 1000, not 1,000. Each number can contain up to 50 digits, and the whole input is limited to 2000 characters. Answers are exact, without rounding.