Skip to main content

GCF / HCF Calculator

  • Runs in your browser: what you type is not uploaded
  • Free, no sign-up
  • Formula and a worked example below

About GCF / HCF Calculator

The GCF Calculator finds the greatest common factor (also called the highest common factor, HCF, or greatest common divisor) of a list of whole numbers — the largest number that divides every value exactly. It also returns the least common multiple.

For example, the GCF of 24, 36 and 60 is 12: each number divides by 12 without a remainder, and no larger whole number divides all three. Their LCM is 360. Try these numbers in the calculator or follow the solved examples below.

The GCF is the key to simplifying fractions, splitting quantities into equal groups, and reducing ratios to their simplest form.

Formula

gcd(a, b) via the Euclidean algorithm: gcd(a, b) = gcd(b, a mod b) until b = 0
  • a, b — two whole numbers
  • a mod b — the remainder when a is divided by b

For more than two numbers, the GCF is found pairwise: gcf(a, b, c) = gcd(gcd(a, b), c).

GCF / HCF Calculator: solved examples

GCF of 48 and 18

  1. Divide the larger number by the smaller and keep the remainder: 48 = 2 × 18 + 12.
  2. Repeat with the divisor and the remainder: 18 = 1 × 12 + 6.
  3. Repeat with the divisor and the remainder: 12 = 2 × 6 + 0.
  4. The remainder is 0, so the GCF of 48 and 18 is the last divisor, 6.
  5. LCM = 48 × 18 ÷ 6 = 144.

Answer: GCF = 6, LCM = 144.

GCF of 84 and 126

  1. Divide the larger number by the smaller and keep the remainder: 126 = 1 × 84 + 42.
  2. Repeat with the divisor and the remainder: 84 = 2 × 42 + 0.
  3. The remainder is 0, so the GCF of 84 and 126 is the last divisor, 42.
  4. LCM = 84 × 126 ÷ 42 = 252.

Answer: GCF = 42, LCM = 252. So 84/126 simplifies to 2/3 by dividing top and bottom by 42.

GCF of 24, 36 and 60

  1. Divide the larger number by the smaller and keep the remainder: 36 = 1 × 24 + 12.
  2. Repeat with the divisor and the remainder: 24 = 2 × 12 + 0.
  3. The remainder is 0, so the GCF of 24 and 36 is the last divisor, 12.
  4. Now find the GCF of that result and the next number, 12 and 60: 60 = 5 × 12 + 0.
  5. The remainder is 0, so the GCF of 12 and 60 is the last divisor, 12.
  6. For the LCM, take two numbers at a time: LCM(24, 36) = 24 × 36 ÷ 12 = 72; then LCM(72, 60) = 72 × 60 ÷ 12 = 360.

Answer: GCF = 12, LCM = 360.

GCF of 35 and 64

  1. Divide the larger number by the smaller and keep the remainder: 64 = 1 × 35 + 29.
  2. Repeat with the divisor and the remainder: 35 = 1 × 29 + 6.
  3. Repeat with the divisor and the remainder: 29 = 4 × 6 + 5.
  4. Repeat with the divisor and the remainder: 6 = 1 × 5 + 1.
  5. Repeat with the divisor and the remainder: 5 = 5 × 1 + 0.
  6. The remainder is 0, so the GCF of 35 and 64 is the last divisor, 1.
  7. LCM = 35 × 64 ÷ 1 = 2,240.

Answer: GCF = 1, LCM = 2,240. A GCF of 1 means 35 and 64 are coprime: they share no factor except 1.

GCF of 252 and 198

  1. Divide the larger number by the smaller and keep the remainder: 252 = 1 × 198 + 54.
  2. Repeat with the divisor and the remainder: 198 = 3 × 54 + 36.
  3. Repeat with the divisor and the remainder: 54 = 1 × 36 + 18.
  4. Repeat with the divisor and the remainder: 36 = 2 × 18 + 0.
  5. The remainder is 0, so the GCF of 252 and 198 is the last divisor, 18.
  6. LCM = 252 × 198 ÷ 18 = 2,772.

Answer: GCF = 18, LCM = 2,772.

How to use the GCF / HCF Calculator

  1. Enter two or more whole numbers, separated by commas, spaces or new lines.
  2. The greatest common factor appears instantly.
  3. The least common multiple is shown alongside for reference.
  4. You can include zeros and negative integers. A zero makes the LCM zero.

Good to know

  • For a list with at least one non-zero value, the GCF is at most the smallest non-zero absolute value.
  • If the GCF of two numbers is 1, they are called coprime (relatively prime).
  • Dividing both parts of a fraction by their GCF gives the fully simplified fraction.

Frequently asked questions about the GCF / HCF Calculator

What is the GCF of 0 and 24?

It is 24. Every positive divisor of 24 also divides zero, and the largest is 24. If every entry is zero, this calculator uses the standard convention GCF = 0.

Are GCF, HCF and GCD the same thing?

Yes. Greatest common factor, highest common factor and greatest common divisor are three names for the same value.

How does the GCF simplify a fraction?

Divide the numerator and denominator by their GCF; the result is the fraction in lowest terms.

What does the Euclidean algorithm do?

It repeatedly replaces the larger number with the remainder of dividing the two, until the remainder is zero — the last non-zero value is the GCF.

What is the GCF if numbers share no factors?

It is 1. Such numbers are said to be coprime or relatively prime.