Home › Math & Science › GCF Calculator

GCF Calculator

Use this GCF calculator to find the greatest common factor of two or three numbers in seconds. Enter your numbers and you get the GCF, the step-by-step Euclidean algorithm working, and the least common multiple (LCM) as a bonus — all worked out instantly in your browser.

Enter positive whole numbers. Leave the third box empty for two numbers, or fill it in to find the GCF of three numbers at once.

GCF of 48 and 180 is 12
LCM is 720 · 12 is the largest number that divides both 48 and 180 exactly
Euclidean algorithm steps for 48 and 180:
  1. 180 ÷ 48 = 3 remainder 36
  2. 48 ÷ 36 = 1 remainder 12
  3. 36 ÷ 12 = 3 remainder 0
  4. The last divisor, 12, is the GCF.

How it works

A factor of a number is a whole number that divides it exactly, with nothing left over. The factors of 12 are 1, 2, 3, 4, 6, and 12. When two numbers share factors, the largest shared one is the greatest common factor, or GCF. It is the biggest size you can cut both numbers into equal pieces — which is why it shows up in real life whenever you split things into equal groups, simplify a fraction, or cut fabric, rope, or floor tiles into the largest equal squares.

GCF(a, b) = the largest number that divides both a and b with no remainder

Listing every factor works for small numbers, but it gets slow fast. This calculator uses the Euclidean algorithm instead, a method from around 300 BC that is still the fastest way to find a GCF by hand. Take the larger number and divide it by the smaller one, keeping the remainder. Then divide the smaller number by that remainder. Keep going, always dividing the last divisor by the last remainder, until a remainder of 0 appears. The last divisor you used is the GCF.

For three numbers, the calculator finds the GCF of the first two, then finds the GCF of that result and the third number. That works because any factor common to all three must divide the GCF of the first two. The steps box under the result shows every division, so you can follow the working and use it for homework.

The LCM, the least common multiple, comes free from the same numbers. The LCM is the smallest number that both of your numbers divide into — handy when you are lining up repeating schedules or adding fractions with different denominators. It is linked to the GCF by a neat rule: GCF × LCM = the product of the two numbers. So once the calculator knows the GCF, the LCM is one division away: LCM = (a × b) ÷ GCF. For three numbers, the LCM is built up the same way, pair by pair.

Worked example

Find the GCF and LCM of 48 and 180.

Step 1: Divide the larger number by the smaller: 180 ÷ 48 = 3 remainder 36, because 48 × 3 = 144 and 180 − 144 = 36.
Step 2: Divide the old divisor by the remainder: 48 ÷ 36 = 1 remainder 12, because 36 × 1 = 36 and 48 − 36 = 12.
Step 3: Divide again: 36 ÷ 12 = 3 remainder 0, because 12 × 3 = 36 exactly.
Step 4: The remainder is 0, so the last divisor is the answer: the GCF of 48 and 180 is 12.

Check it by listing the shared factors: 1, 2, 3, 4, 6, and 12 all divide both 48 and 180, and 12 is the largest. Then the LCM is (48 × 180) ÷ 12 = 8,640 ÷ 12 = 720. Try it yourself: enter 48 and 180, with the third box empty. The tool gives exactly the same answer — GCF of 48 and 180 is 12, with LCM 720 — and the steps box shows the same three divisions.

Try three numbers next: 24, 36, and 60. The GCF of 24 and 36 is 12, and the GCF of 12 and 60 is also 12, so the GCF of all three is 12, and their LCM is 360. Or try two primes, 17 and 23: the Euclidean algorithm runs until the remainder is 0 with a last divisor of 1, so their GCF is 1 and their LCM is 17 × 23 = 391.

FAQ

What is the greatest common factor (GCF)?

The greatest common factor is the largest whole number that divides two or more numbers exactly, with no remainder. For example, the factors of 12 are 1, 2, 3, 4, 6, and 12, and the factors of 18 are 1, 2, 3, 6, 9, and 18, so their greatest common factor is 6.

How does the Euclidean algorithm find the GCF?

You divide the larger number by the smaller one and keep the remainder, then divide the smaller number by that remainder, and repeat until the remainder is 0. The last number you divided by is the GCF. For 48 and 180: 180 divided by 48 leaves 36, 48 divided by 36 leaves 12, and 36 divided by 12 leaves 0, so the GCF is 12.

What is the difference between GCF and LCM?

The GCF is the largest number that divides both numbers, while the LCM — the least common multiple — is the smallest number both numbers divide into. For 48 and 180, the GCF is 12 and the LCM is 720. They are linked by a simple rule: GCF times LCM equals the product of the two numbers.

What is the GCF when one of the numbers is 1?

It is always 1, because 1 is the only factor the numbers are guaranteed to share. Any number paired with 1 has a GCF of 1, and two prime numbers such as 17 and 23 also have a GCF of 1 — they are called coprime.

Why does this calculator not accept 0 or negative numbers?

The GCF is defined for positive whole numbers, and 0 has no greatest factor — every number divides 0, so there is no largest one. Negative numbers do have a GCF in the strict sense, but school and everyday problems always use positive numbers, so this calculator asks for positive whole numbers and explains the problem instead of guessing.