LCM & GCF Calculator
The greatest common factor and least common multiple of 2–6 integers — with the Euclidean algorithm and the prime-factor method worked out line by line.
Euclidean algorithm (GCF)
Prime factorization of each number
Prime-factor method
How to use the LCM & GCF calculator
- Enter 2–6 integers. Separate them with commas or spaces — e.g. 12, 18, 30. Negatives are fine.
- Press Calculate. You get the GCF and LCM up top, instantly.
- Check the Euclidean working. Each “dividend = divisor × quotient + remainder” line is one round of the algorithm — the last nonzero remainder is the GCF.
- Read the prime-factor method. Each number is factored, then the GCF takes shared primes at their smallest exponents and the LCM takes every prime at its largest.
- Use it for homework. Copy the working into your notebook — it follows the exact steps most textbooks teach.
Frequently asked questions
What is the difference between GCF and LCM?
The GCF (greatest common factor) is the biggest number that divides all your numbers evenly. The LCM (least common multiple) is the smallest number that all of them divide into evenly. For 12 and 18: GCF = 6, LCM = 36.
How does the Euclidean algorithm find the GCF?
It repeatedly replaces the larger number with the remainder of dividing by the smaller one. For 48 and 18: 48 = 18 × 2 + 12, then 18 = 12 × 1 + 6, then 12 = 6 × 2 + 0 — the last nonzero remainder, 6, is the GCF.
How do you find LCM from prime factorization?
Take every prime that appears in any number, raised to the highest exponent it reaches. For 12 = 2² × 3 and 18 = 2 × 3², the LCM uses 2² and 3²: 2² × 3² = 36.
Why do you use absolute values for negative numbers?
Divisibility doesn’t care about sign: −12 is divisible by exactly the same numbers as 12. Using absolute values keeps the GCF and LCM positive and consistent.
What happens with zero in the list?
If every number is zero, the GCF is undefined, so this calculator asks for at least one nonzero number. A single zero is fine: it leaves the GCF unchanged, but the LCM becomes 0, since 0 is a multiple of every number.
More from the codex
LCM & GCF Calculator
GCF, LCM, and prime factorization of up to 6 numbers.
Prime Factorization Calculator
Factor any integer up to a trillion, step by step.
Open tool → LivePermutation & Combination Calculator
nPr and nCr, with or without repetition.
Open tool → LiveProbability Calculator
Single events, AND, OR, and complements — fraction, decimal, percent.
Open tool →Questions or feedback?
Found a bug or want a feature? Email [email protected] — every message is read by the indie dev behind the codex.