GCF & LCM Calculator
Enter two to ten whole numbers to get their greatest common factor (GCF, also called HCF or GCD) and least common multiple (LCM), with each number's prime factorisation, a table of prime powers and Euclid's algorithm for the first two.
-GCF (HCF, GCD)
-LCM
These numbers are coprime: their only common factor is 1.
Prime factorisations
Each cell is the power of that prime. GCF takes the smallest power in each column (0 if any number lacks the prime); LCM takes the largest.
Euclid's algorithm (first two numbers)
Worked example: 8, 12 and 20
- Factorise each number
8 = 2³ 12 = 2² × 3 20 = 2² × 5 - GCF: primes in every number, lowest power
2² = 4 (3 and 5 are not in all three) - LCM: every prime, highest power
2³ × 3 × 5 = 120 - Euclid for 8 and 12
12 = 1 × 8 + 4, 8 = 2 × 4 + 0 → GCF(8, 12) = 4
Where you actually use them
- Simplifying fractions: divide top and bottom by their GCF. 18/24 → GCF 6 → 3/4.
- Adding fractions: the lowest common denominator is the LCM of the denominators. 1/4 + 1/6 → LCM 12.
- Sharing equally: the GCF is the largest group size that splits several quantities with nothing left over - 24 pens and 36 pencils make at most 12 identical packs.
- Things that repeat: the LCM tells you when cycles line up - buses every 12 and 18 minutes leave together every 36 minutes.
What this calculator does not do
- Positive whole numbers up to 1,000,000,000,000; 2 to 10 numbers at a time.
- Euclid's algorithm is shown for the first two numbers only.
- No fractions or decimals - to find a common denominator, enter the denominators.
Frequently asked questions
What is the difference between GCF and LCM?
The greatest common factor is the largest number that divides all of them. The least common multiple is the smallest number all of them divide into. For 12 and 18 the GCF is 6 and the LCM is 36.
Are GCF, HCF and GCD the same?
Yes. Greatest common factor, highest common factor and greatest common divisor are three names for the same number.
How do you find the GCF and LCM with prime factors?
Write each number as a product of primes. The GCF multiplies each prime that appears in every number, to its lowest power. The LCM multiplies every prime that appears anywhere, to its highest power. 8 = 2³, 12 = 2² × 3, 20 = 2² × 5: GCF = 2² = 4, LCM = 2³ × 3 × 5 = 120.
What is Euclid's algorithm?
A fast way to find the GCF of two numbers: divide the larger by the smaller, keep the remainder, and repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF.
Is there a shortcut for two numbers?
Yes: GCF × LCM = the product of the two numbers. For 12 and 18, 6 × 36 = 216 = 12 × 18. This shortcut does not work for three or more numbers.
Why is 0 not allowed?
Every whole number divides 0, so 0 has no greatest common factor with anything in the usual sense, and the only common multiple of 0 is 0. The calculator asks for positive whole numbers.
Related free tools
➗
Fraction CalculatorAdd, subtract, multiply, divide and simplify fractions, with each step shown.
🧮Long Division CalculatorLong division written out step by step, with remainder and repeating decimals.
📐Quadratic Formula CalculatorExact roots of ax² + bx + c = 0 (radicals, complex), vertex and factored form.
🧮Mean, Median & Mode CalculatorMean, median, mode(s) and range with the sorted data and working.
Step-by-step guide: How to find the GCF and LCM →