Skip to content

GCF Calculator

Find the GCF/GCD and LCM of any integers, with steps

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Type two or more whole numbers into the box, separated by commas, spaces, or new lines — for example 12, 18, 24.
  2. 2.The greatest common factor (GCF/GCD) and least common multiple (LCM) appear instantly below, with no button to press.
  3. 3.Read the worked steps to see how each result was folded pairwise using the Euclidean algorithm and the LCM formula.

About GCF Calculator

The greatest common factor (GCF, also called the greatest common divisor or GCD) of a set of integers is the largest whole number that divides every one of them with no remainder, and the least common multiple (LCM) is the smallest positive whole number that each of them divides into evenly. This calculator takes two or more integers — type them separated by commas, spaces, or new lines — and returns both the GCF and the LCM the moment you finish typing, along with the worked steps. Nothing is sent to a server; every calculation runs in your browser.

To find the GCF the tool uses the Euclidean algorithm, one of the oldest methods in mathematics. It repeatedly replaces the larger number with the remainder of dividing the larger by the smaller — gcd(a, b) = gcd(b, a mod b) — until the remainder reaches zero, and the last non-zero value is the GCF. For example, gcd(48, 36) = gcd(36, 12) = gcd(12, 0) = 12. For three or more numbers it folds the operation pairwise: gcd(12, 18, 24) = gcd(gcd(12, 18), 24) = gcd(6, 24) = 6, and the same answer appears whatever order you enter the numbers in.

The LCM is built from the GCF using the identity lcm(a, b) = |a × b| ÷ gcd(a, b). The tool divides before it multiplies — |a| ÷ gcd(a, b) × |b| — so the intermediate numbers stay as small as possible and large inputs are less likely to overflow. Like the GCF, the LCM of a longer list is folded pairwise, so lcm(3, 4, 5) = lcm(lcm(3, 4), 5) = lcm(12, 5) = 60. If any of your numbers is 0 the LCM is reported as undefined, because zero has no positive multiples and therefore no common multiple with the rest.

These two quantities show up constantly in everyday arithmetic. The GCF is what reduces a fraction to lowest terms: dividing the numerator and denominator of 18/24 by their GCF of 6 gives 3/4. The LCM is the least common denominator used to add or subtract fractions with different denominators — to add 1/4 and 1/6 you rewrite both over the LCM of 4 and 6, which is 12. The GCF also helps when you need to split things into the largest equal groups, while the LCM answers 'when do two repeating cycles line up again', such as two events that recur every 4 and every 6 days meeting again after 12.

The calculator accepts negative numbers by working with their absolute values, since factors and multiples are counted as positive quantities, so the GCF of −8 and 12 is 4. Repeated values are fine and do not change the result, and a single number simply returns itself for both the GCF and the LCM. Non-integers such as 1.5 are rejected with a clear message, because the GCF and LCM are only defined for whole numbers, and very large inputs beyond the safe integer range are flagged so you know the answer may be rounded. Use it for homework, simplifying fractions, finding least common denominators, scheduling repeating events, or any time you need exact factor-and-multiple answers instead of guesswork.

Frequently asked questions

What is the difference between the GCF and the LCM?
The greatest common factor (GCF, or GCD) is the largest number that divides all of your numbers exactly, while the least common multiple (LCM) is the smallest positive number that all of them divide into. For 4 and 6, the GCF is 2 (the biggest shared divisor) and the LCM is 12 (the first shared multiple).
How do you find the greatest common factor?
This tool uses the Euclidean algorithm: replace the larger number with the remainder of dividing it by the smaller, and repeat until the remainder is 0 — the last non-zero value is the GCF. For example gcd(48, 36) = gcd(36, 12) = gcd(12, 0) = 12. For three or more numbers the step is folded pairwise, so gcd(12, 18, 24) = gcd(6, 24) = 6.
How do you find the least common multiple?
The LCM comes from the GCF with lcm(a, b) = |a × b| ÷ gcd(a, b). For 4 and 6 that is (4 × 6) ÷ 2 = 12. Dividing before multiplying keeps the numbers small, and for longer lists the LCM is folded pairwise, so lcm(3, 4, 5) = lcm(12, 5) = 60.
Can it handle more than two numbers or negative numbers?
Yes. Enter as many integers as you like and the GCF and LCM are computed by folding the numbers pairwise, so the result is independent of their order. Negative numbers are handled by their absolute value because factors and multiples are counted as positive, so the GCF of −8 and 12 is 4. Duplicate values do not change the answer.
What happens if I enter 0 or a decimal like 1.5?
If one number is 0, its GCF with any number n is n itself (0 is divisible by every integer), but the LCM is shown as undefined because zero has no positive multiples. Decimals such as 1.5 are rejected with a message, since the GCF and LCM are only defined for whole numbers — convert to integers first if you can.

Calculators guides

View all