GCF and LCM Calculator
The GCF and LCM calculator only needs the numbers, separated by commas or spaces – two to ten whole numbers. You get the GCF (GCD), the LCM and both methods step by step.
Source: Wolfram MathWorld – Greatest common divisor. Updated: .
How it is calculated
The greatest common factor (GCF, also GCD or HCF) is the largest number that divides all the given numbers exactly; the least common multiple (LCM) is the smallest number that is a multiple of all of them. For 12 and 18, GCF = 6 and LCM = 36. For two numbers they are linked: GCF × LCM = a × b.
GCF and LCM with prime factorization
Write each number as a product of primes: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. For the GCF, take only the primes that appear in every number, each with its smallest exponent: 2 × 3 = 6. For the LCM, take every prime with its largest exponent: 2² × 3² × 5 = 180.
GCF with the Euclidean algorithm
Faster for large numbers: divide the larger number by the smaller, then the divisor by the remainder, and repeat until the remainder is 0. The last divisor is the GCF. Example: 1071 = 2 × 462 + 147, 462 = 3 × 147 + 21, 147 = 7 × 21 + 0 → GCF = 21. The method goes back to Euclid’s Elements, Book VII.
What are GCF and LCM used for?
- Simplifying fractions: divide top and bottom by the GCF – 12/18 = 2/3.
- Common denominators: the least common denominator is the LCM of the denominators, e.g. LCM(4, 6) = 12 for 1/4 + 1/6.
- Everyday problems: cutting ribbons or tiles into equal pieces with nothing left over (GCF); when two buses leave together again (LCM).
Keep going with fractions in the fraction calculator, convert decimals with the decimal to fraction calculator, or use the calculator for anything else.
Frequently asked questions
How do you find the GCF?
Either factor both numbers into primes and multiply the shared factors (12 = 2² × 3, 18 = 2 × 3² → 2 × 3 = 6), or use the Euclidean algorithm and keep dividing by the remainder.
How do you find the LCM?
Multiply every prime factor using its highest exponent: LCM(12, 18) = 2² × 3² = 36. For two numbers you can also use LCM = a × b ÷ GCF = 12 × 18 ÷ 6 = 36.
How do I find the GCF and LCM of three numbers?
Step by step: first the first two, then combine with the third. GCF(12, 18, 30) = GCF(6, 30) = 6 and LCM(12, 18, 30) = LCM(36, 30) = 180.
What does relatively prime mean?
Two numbers are relatively prime (coprime) when their GCF is 1, like 8 and 15. Their LCM is then simply the product: 8 × 15 = 120.
Is GCF the same as GCD and HCF?
Yes – greatest common factor, greatest common divisor and highest common factor are three names for the same number.
Sources and legal basis
- Wolfram MathWorld – Greatest common divisor
- Wolfram MathWorld – Least common multiple
- Wolfram MathWorld – Euclidean algorithm
- Euclid, Elements VII.2 – greatest common measure (Clark University)
As of:
Related tools
- Fraction CalculatorAdd, subtract, multiply and divide fractions and mixed numbers with step-by-step solutions. Simplify fractions and convert decimals to fractions.
- Decimal to Fraction CalculatorDecimal to fraction calculator: simplest form, mixed number, repeating decimals, inch fractions (1/16, 1/64) and fraction to decimal – with the steps.
- Square Root CalculatorSquare root calculator with steps: square, cube and nth roots, simplified radical form (√72 = 6√2), prime factorisation and the Babylonian method.
- Online CalculatorFree online calculator: type or tap and see the answer instantly – with order of operations, brackets, percent, square root, steps and history.
- Age CalculatorCalculate your exact age from your date of birth in years, months and days, in total days, weeks and months – plus the countdown to your next birthday.
- Average CalculatorAverage calculator: mean, median and mode of a list of numbers, plus geometric, harmonic and weighted average – paste from Excel, get the working instantly.