Xerobit

GCF Calculator: Find the Greatest Common Factor with Euclidean Algorithm

This gcf calculator finds the greatest common factor (also called greatest common divisor) of two or more integers. Enter numbers separated by commas or spaces to get the GCF with a full Euclidean algorithm breakdown. It handles negatives, zero, and large values, and runs in your browser with no data sent anywhere.

Enter at least two integers. Negatives and zero are allowed.

Result

  • GCF
    12
  • Numbers
    48, 180, 300
  • Steps
    GCF of 48 and 180:; 48 ÷ 180 = 0 remainder 48; 180 ÷ 48 = 3 remainder 36; 48 ÷ 36 = 1 remainder 12; 36 ÷ 12 = 3 remainder 0; → 12; GCF of 12 and 300:; 12 ÷ 300 = 0 remainder 12; 300 ÷ 12 = 25 remainder 0; → 12

How to use the gcf calculator

  1. Enter two or more integers separated by commas or spaces.
  2. Read the GCF result and the step-by-step Euclidean algorithm breakdown.
  3. Copy the result or use it in another calculation.

How the Euclidean algorithm works

The Euclidean algorithm finds the greatest common factor by repeated division. For two numbers a and b where a > b, divide a by b and take the remainder r. Then replace a with b and b with r and repeat until the remainder is zero. The last non-zero remainder is the GCF.

Example with 48 and 180:

  • 180 ÷ 48 = 3 remainder 36
  • 48 ÷ 36 = 1 remainder 12
  • 36 ÷ 12 = 3 remainder 0

The last non-zero remainder is 12, so GCF(48, 180) = 12. For more than two numbers, the calculator computes the GCF of the first pair, then uses that result with the next number, and so on. This pairwise reduction is mathematically sound because GCF(a, b, c) = GCF(GCF(a, b), c). The gcf calculator displays each division step so you can verify the process or use it for teaching.

Common GCF values reference

Quick reference for frequent pairs:

NumbersGCF
12, 186
24, 3612
48, 18012
100, 25050
17, 311
0, 4242
-84, 12642

You can extend this table by entering your own pairs into the gcf calculator above.

When to use a GCF calculator

Greatest common factor calculations appear in many practical situations:

  • Simplifying fractions: divide numerator and denominator by their GCF to reduce to lowest terms. For example, 48/180 simplifies to 4/15 because GCF(48, 180) = 12.
  • Factoring polynomials: pull out the GCF of coefficients as a first step. If the coefficients are 6, 9, and 15, their GCF is 3.
  • Tiling and packing: find the largest square tile that fits a rectangular floor, or the largest box size that packs items evenly. A floor of 48 by 180 inches can be tiled with 12-inch squares.
  • Cryptography: the Euclidean algorithm underpins RSA key generation and modular inverses. The extended Euclidean algorithm finds integer solutions to ax + by = GCF(a, b).
  • Music theory: GCF of frequencies determines harmonic relationships. Two notes with frequencies 440 Hz and 660 Hz have a GCF of 220 Hz, an octave below the lower note.

Edge cases and common mistakes

Zero: GCF(0, n) = |n|. GCF(0, 0) is defined as 0 by convention. Negatives: the GCF is always non-negative; GCF(-a, b) = GCF(a, b). Single number: the GCF of one number is its absolute value, but most contexts expect at least two numbers; this tool requires at least two inputs. Decimals: this tool only accepts integers; multiply by a power of ten first if you need rational GCF. Large numbers: the algorithm is fast (logarithmic steps), so any number the tool accepts finishes instantly. JavaScript represents integers exactly up to 2^53 - 1 (about 9 quadrillion), so this tool rejects larger integers instead of returning a wrong answer.

GCF versus LCM

The least common multiple (LCM) is the smallest positive integer divisible by all given numbers. For two numbers a and b, the relationship is GCF(a, b) × LCM(a, b) = |a × b|. This calculator focuses on GCF; for LCM see the LCM calculator. Both tools use the same Euclidean algorithm core. Knowing both GCF and LCM is useful for adding fractions with different denominators: the common denominator is the LCM, and the GCF helps reduce the result.

Worked examples

ExampleInputResult
Three numbersIntegers (comma or space separated): 48, 180, 300GCF: 12; Numbers: 48, 180, 300; Steps: GCF of 48 and 180:; 48 ÷ 180 = 0 remainder 48; 180 ÷ 48 = 3 remainder 36; 48 ÷ 36 = 1 remainder 12; 36 ÷ 12 = 3 remainder 0; → 12; GCF of 12 and 300:; 12 ÷ 300 = 0 remainder 12; 300 ÷ 12 = 25 remainder 0; → 12
Two large numbersIntegers (comma or space separated): 123456, 789012GCF: 12; Numbers: 123,456, 789,012; Steps: 123456 ÷ 789012 = 0 remainder 123456; 789012 ÷ 123456 = 6 remainder 48276; 123456 ÷ 48276 = 2 remainder 26904; 48276 ÷ 26904 = 1 remainder 21372; 26904 ÷ 21372 = 1 remainder 5532; 21372 ÷ 5532 = 3 remainder 4776; 5532 ÷ 4776 = 1 remainder 756; 4776 ÷ 756 = 6 remainder 240; 756 ÷ 240 = 3 remainder 36; 240 ÷ 36 = 6 remainder 24; 36 ÷ 24 = 1 remainder 12; 24 ÷ 12 = 2 remainder 0
With negatives and zeroIntegers (comma or space separated): -84, 0, 126GCF: 42; Numbers: -84, 0, 126; Steps: GCF of 84 and 0:; → 84; GCF of 84 and 126:; 84 ÷ 126 = 0 remainder 84; 126 ÷ 84 = 1 remainder 42; 84 ÷ 42 = 2 remainder 0; → 42
Coprime pairIntegers (comma or space separated): 17, 31GCF: 1; Numbers: 17, 31; Steps: 17 ÷ 31 = 0 remainder 17; 31 ÷ 17 = 1 remainder 14; 17 ÷ 14 = 1 remainder 3; 14 ÷ 3 = 4 remainder 2; 3 ÷ 2 = 1 remainder 1; 2 ÷ 1 = 2 remainder 0
Multiple numbers with zeroIntegers (comma or space separated): 0, 5, 10GCF: 5; Numbers: 0, 5, 10; Steps: GCF of 0 and 5:; → 5; GCF of 5 and 10:; 5 ÷ 10 = 0 remainder 5; 10 ÷ 5 = 2 remainder 0; → 5

FAQ

What is the difference between GCF and GCD?

They are the same concept. GCF stands for greatest common factor, GCD for greatest common divisor. Both mean the largest positive integer that divides all given numbers without a remainder.

How does the calculator handle negative numbers?

It takes the absolute value of each input. The GCF is always reported as a non-negative integer.

What is the GCF of zero and another number?

GCF(0, n) = |n|. Every integer divides zero, so the greatest divisor of n is |n| itself.

Can I find the GCF of more than two numbers?

Yes. Enter any amount of integers separated by commas or spaces. The calculator reduces the list pairwise using the Euclidean algorithm.

Why does the Euclidean algorithm work?

If a = bq + r, any common divisor of a and b also divides r, and vice versa. So the set of common divisors is unchanged, and the greatest one is preserved at each step.

Is there a limit on the size of numbers?

The tool uses JavaScript's 64-bit floating point numbers, which represent integers exactly up to 2^53 - 1 (about 9 quadrillion). Beyond that, precision may be lost.

How do I simplify a fraction with this tool?

Enter the numerator and denominator. The GCF is the number to divide both by. For example, GCF(48, 180) = 12, so 48/180 simplifies to 4/15.