GCF and LCM Calculator
Find the greatest common factor (GCF, also called GCD or HCF) and the least common multiple (LCM) of 2 to 10 whole numbers. See each number's prime factorisation and, for two numbers, the Euclidean algorithm steps. It runs in your browser and nothing is uploaded.
Your numbers
Enter 2 to 10 whole numbers, separated by commas or spaces.
Result
Prime factorisation
- 12 = 2^2 × 3
- 18 = 2 × 3^2
- 30 = 2 × 3 × 5
Divide every number by the GCF to reduce them to lowest terms: 12 : 18 : 30 becomes 2 : 3 : 5.
How to find the GCF and LCM
- Type your numbers, separated by commas or spaces.
- Read the GCF and LCM at the top of the result.
- Check the prime factorisation below to see how they were found.
By hand with prime factors
For 12 = 2² × 3 and 18 = 2 × 3², the GCF takes the primes both share at their lowest power: 2 × 3 = 6. The LCM takes every prime at its highest power: 2² × 3² = 36. For two numbers, GCF × LCM equals the product of the numbers (6 × 36 = 12 × 18).
Related tools
Use the GCF to reduce fractions and the LCM as a common denominator in the fraction calculator, simplify a ratio with the ratio calculator, or find the typical value of a list with the average calculator.
See also
- Add, subtract and simplify fractions with the fraction calculator.
- Simplify a ratio to its lowest terms with the ratio calculator.
- Find the mean, median and mode of a list with the average calculator.
- Work out percentages with the percentage calculator.
Frequently Asked Questions (FAQ)
The GCF is the largest whole number that divides every number in the list with no remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF). The GCF of 12 and 18 is 6.
The LCM is the smallest positive number that every number in the list divides into evenly. The LCM of 12 and 18 is 36. It is the common denominator you need to add fractions.
Write each number as a product of primes, then multiply the primes they all share, each to the lowest power. For 12 = 2² × 3 and 18 = 2 × 3², the shared part is 2 × 3 = 6.
Multiply every prime that appears in any of the numbers, each to its highest power. For 12 and 18 that is 2² × 3² = 36.
For two numbers, GCF × LCM = the product of the numbers. So LCM(a, b) = a × b ÷ GCF(a, b). For 12 and 18: 6 × 36 = 216 = 12 × 18. It only holds for two numbers.
Divide the larger number by the smaller and keep the remainder. Repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF. The calculator shows these steps for two numbers.
The numbers are called coprime (relatively prime). They share no factor except 1. For two numbers, their LCM is simply their product, and the fraction a/b is already in lowest terms. With three or more numbers, a GCF of 1 does not mean every pair is coprime, so the LCM can be smaller than the product (6, 10 and 15 have GCF 1 but LCM 30).
From 2 to 10 whole numbers, each up to 1,000,000,000,000. The LCM can be much bigger and is still calculated exactly. Nothing is uploaded; it all runs in your browser.