GCF & LCM Calculator
Enter two or more whole numbers to find their greatest common factor (GCF) and least common multiple (LCM).
Reviewed by the WorldCalcs team · Methodology · Last reviewed: June 2026
Result
Numbers: 12, 18
GCF = 6
LCM = 36
What are the GCF and LCM?
The greatest common factor (GCF), also called the greatest common divisor, is the largest whole number that divides evenly into two or more numbers. The least common multiple (LCM) is the smallest whole number that all of them divide into. For 12 and 18 the GCF is 6 and the LCM is 36. The two are closely linked and appear whenever you simplify fractions, add fractions with different denominators, or work out repeating cycles. This calculator finds both for any list of whole numbers.
How they're calculated
The quickest way to find the GCF is the Euclidean algorithm: divide the larger number by the smaller, replace the larger with the remainder, and repeat until the remainder is zero; the last non-zero value is the GCF. The LCM then follows from a simple relationship: for two numbers, LCM = (a x b) divided by GCF. For longer lists, apply the operation two numbers at a time. You can also read both off the prime factorisation: the GCF multiplies the shared primes at their lowest powers, the LCM uses every prime at its highest power. See our Prime Factorization Calculator.
Example
Take 12 and 18. The factors of 12 are 1, 2, 3, 4, 6, 12 and of 18 are 1, 2, 3, 6, 9, 18; the largest shared factor is 6, so the GCF is 6. The LCM is (12 x 18) divided by 6 = 216 divided by 6 = 36, the smallest number that both 12 and 18 divide into.
All calculations happen in your browser. Nothing is sent, stored, or tracked.
Results are estimates and may contain errors — for general information only, not professional advice. Always verify before relying on them. Disclaimer
How to use
Type two or more positive whole numbers separated by commas, spaces or new lines.
The calculator shows the greatest common factor and the least common multiple, using the Euclidean algorithm for the GCF and the pairwise-product method for the LCM.