Smekys
Ad Space

GCF Calculator

Free GCF calculator: instantly find the greatest common factor of two integers, reduce a fraction, and derive the LCM.

Enter Values

integer

The first non-negative whole number (for example, 48).

integer

The second non-negative whole number (for example, 180).

Result

Greatest Common Factor (GCF)
12
a ÷ GCF (simplified)
4
b ÷ GCF (simplified)
15
Least Common Multiple (LCM)
720

The greatest common factor (GCF) of two whole numbers is the largest number that divides both of them evenly, with nothing left over. If you have ever tried to simplify a fraction, cut two lengths of board into the longest matching pieces, or split a box of chocolates into the largest number of identical gift bags, you have already needed the GCF without calling it by that name. This GCF calculator takes two non-negative integers and returns the greatest common factor, the reduced ratio between them, and the least common multiple (LCM) — all in a single step.

Type any two whole numbers into the boxes and every result updates instantly. The engine works out the prime factorization of each input, takes the smaller exponent of every shared prime, and multiplies those primes back together. For a cross-check, the same answer is reached through the Euclidean algorithm, the 2,300-year-old shortcut that skips factoring altogether.

How to Use

  1. Enter the First Integer (a) — the larger of the two if you happen to know it, though order does not change the result.
  2. Enter the Second Integer (b) — the other whole number you want to compare.
  3. Read the Greatest Common Factor (GCF) in the highlighted result card. This is the largest number that divides both inputs with a remainder of zero.
  4. The common factors of a and b are exactly the positive divisors of the GCF itself — for example, if the GCF is 12, the common factors are 1, 2, 3, 4, 6, and 12 (the last one is the GCF). You can list them by hand by checking which whole numbers divide the GCF.
  5. Use the two simplified figures (a ÷ GCF and b ÷ GCF) to reduce a fraction or ratio to its lowest terms. For example, if a = 48 and b = 180, the ratio 48:180 reduces cleanly to 4:15.
  6. Check the Least Common Multiple (LCM). It is the smallest number that both inputs divide into evenly, and it is automatically derived from the GCF.

The calculator accepts zero: the GCF of 0 and any number n is n itself, because every integer divides zero. Negative integers are not accepted, because divisibility is defined on non-negative whole numbers; if you need the result for a negative pair, just enter the absolute values — the sign does not change the factor.

How the GCF Is Found

There are two classic ways to compute the GCF. The classroom method is prime factorization:

  • Break each number into primes. For example, 48 = 2⁴ × 3 and 180 = 2² × 3² × 5.
  • For each prime that appears in both, take the smaller exponent. Shared primes are 2 (min exponent 2) and 3 (min exponent 1).
  • Multiply them back: 2² × 3 = 4 × 3 = 12.

That is the GCF of 48 and 180. To list every common factor, take all divisors of 12 in ascending order: 1, 2, 3, 4, 6, 12.

The faster method for large numbers is the Euclidean algorithm, which repeatedly replaces the larger number by its remainder after dividing by the smaller one: gcf(a, b) = gcf(b, a mod b), until b becomes 0. Walk through gcf(48, 180): 180 mod 48 = 36, then 48 mod 36 = 12, then 36 mod 12 = 0. The last non-zero remainder is 12. Notice we never had to list a single factor.

From the GCF, the LCM follows directly with lcm(a, b) = |a × b| ÷ gcf(a, b). For 48 and 180 that is (48 × 180) ÷ 12 = 8,640 ÷ 12 = 720. The simplified ratio is 48 ÷ 12 = 4 and 180 ÷ 12 = 15, so 48:180 reduces to 4:15.

Where the GCF Shows Up in Real Life

You do not need to be a mathematician to need this number. If a $48 grocery run and a $180 electric bill share a weekly budget, the GCF of 12 tells you the cleanest way to split both into equal weekly envelopes: 4 weekly grocery dollars and 15 weekly electric dollars per envelope, 12 envelopes total. If you are tiling a wall that is 48 inches wide and 180 inches tall, a GCF of 12 means the largest square tile that covers the wall with no cutting is 12 × 12 inches — four tiles across and fifteen up. If you have 48 red marbles and 180 blue ones and want to make the greatest number of identical bags, 12 bags is the maximum, each carrying 4 red and 15 blue.

Examples

Example 1 — Two everyday numbers (48 and 180). Enter a = 48 and b = 180. The GCF is 12, the common factors are 1, 2, 3, 4, 6, and 12, the LCM is 720, and the reduced ratio is 4:15. If you were splitting a $48 dinner tab and a $180 wine budget among the largest number of identical shares, 12 people would be the clean answer — each owing $4 for food and $15 for wine.

Example 2 — Small coprime numbers (100 and 35). Enter a = 100 and b = 35. Factoring: 100 = 2² × 5², and 35 = 5 × 7. The only shared prime is 5, so the GCF is 5, the common factors are just 1 and 5, the LCM is 700, and the reduced ratio is 20:7. A GCF of 5 means 100 and 35 share only one factor besides 1.

Example 3 — One of the numbers is zero. Enter a = 0 and b = 15. Because every integer divides zero, the greatest common factor is simply 15, and the simplified pair is 0 and 1. The LCM in this case is 0.

Example 4 — Very large integers (1,000,000 and 500,000). Enter a = 1,000,000 and b = 500,000. The Euclidean algorithm returns a GCF of 500,000 in a single step, an LCM of 1,000,000, and a reduced ratio of 2:1. The engine handles numbers well beyond a million without any loss of precision.

Example 5 — Coprime large numbers. Enter a = 1,234,567 and b = 7,654,321. These share no common factor greater than 1, so the GCF is 1, and the LCM is the full product of the two. A GCF of 1 means the two numbers are coprime, which matters in cryptography and fraction reduction.

FAQ

What does GCF stand for?

GCF stands for greatest common factor. It is the largest whole number that divides two given integers exactly, with no remainder left over. You may also see it called GCD (greatest common divisor), HCF (highest common factor), or sometimes GCM (greatest common measure) — all of them mean the same number. This calculator uses the GCF naming most often taught in US middle-school math.

How is the greatest common factor calculated?

Two ways. The classroom method lists the prime factors of each number, takes the smaller exponent of every shared prime, and multiplies them back together. The faster method is the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller one, until the remainder is zero. The last non-zero remainder is the GCF. This calculator runs both methods and returns the same answer.

What is the difference between GCF and LCM?

The GCF is the largest number that divides both inputs; the LCM (least common multiple) is the smallest number that both inputs divide into. They are close cousins, linked by the formula lcm(a, b) = |a × b| ÷ gcf(a, b). The GCF helps you split things into the largest equal pieces; the LCM helps you find when two repeating cycles coincide.

What is the GCF when one number is zero?

The GCF of 0 and any number n is n itself, because every integer divides zero. So gcf(0, 15) = 15. The only special case is gcf(0, 0), which is mathematically undefined, though most calculators return 0 as a convenience.

Can I use negative numbers?

Mathematically the GCF is always a non-negative value, and sign does not matter — gcf(−48, 180) equals gcf(48, 180) = 12. To keep the inputs unambiguous, this calculator asks for non-negative integers; if you have a negative value, simply enter its absolute value. The result will be identical.

Is the GCF of two numbers ever 1?

Yes. When two integers share no common factor other than 1, they are called coprime, and their GCF is 1. For example, gcf(1,234,567, 7,654,321) = 1. Coprime numbers show up constantly in encryption, musical tuning, and fraction simplification.

How do I simplify a fraction with the GCF?

Divide both the numerator and the denominator by their GCF. To reduce 48/180, compute the GCF (which is 12), then divide top and bottom by 12: 48 ÷ 12 = 4 and 180 ÷ 12 = 15, so the fraction simplifies to 4/15. The two "simplified" figures in the result card do exactly this for you.

Disclaimer

This GCF calculator is provided for informational purposes only and does not constitute mathematical, academic, financial, or other professional advice. Results are computed from the non-negative integers you enter using prime factorization cross-checked with the Euclidean algorithm, and are exact for whole-number inputs, but you are responsible for verifying any outcome you rely on — especially in budgeting, scheduling, homework, engineering, or construction. Always cross-check important calculations with an authoritative source.

Related Calculators

Disclaimer

Results are estimates for illustration only. Verify important figures independently.