Skip to content
CalculatorAtlas

GCF Calculator

Tested

Greatest common factor (greatest common divisor) of two or more numbers.

Tested, not yet published. The formula for this calculator is implemented and passes its automated checks. This page stays non-indexable until it is reviewed and published.

Results

Enter your values and press Calculate. Results appear here.

  • • Result

Quick answer

The greatest common factor (GCF) is the largest number that divides all the given numbers. For 48 and 18 the Euclidean algorithm gives gcd(48, 18) = gcd(18, 12) = gcd(12, 6) = 6.

Enter two or more positive whole numbers. The calculator returns their greatest common factor.

Related tools: Slope Calculator: Slope, angle, distance and line equation through two points. LCM Calculator: Least common multiple of two or more numbers. Factor Calculator: List every factor of a positive whole number.

How to use the GCF Calculator

  1. Type numbers, for example 12, 18, 24.
  2. Press Calculate to see the result, and use Reset to start again.
Inputs of the GCF Calculator
InputWhat to enterAllowed values
NumbersText, such as 12, 18, 24—

Formula and method

Formula

gcd(a, b) = gcd(b, a mod b); gcd(a, b, c) = gcd(gcd(a, b), c)

IEEE-754 double precision; shown to at most 6 decimal places.

The Euclidean algorithm applied pairwise across the list.

Worked examples

These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.

Example 1

Inputs: Numbers = 48, 18.

Results of example 1
ResultValue
Greatest common factor6

Example 2

Inputs: Numbers = 17, 31.

Results of example 2
ResultValue
Greatest common factor1

The first line is the headline result (greatest common factor). IEEE-754 double precision; shown to at most 6 decimal places.

Two methods

Euclidean: repeatedly replace the larger number with the remainder; 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0, so the answer is 6. Prime factorisation: 48 = 2⁴ × 3 and 18 = 2 × 3², so the GCF takes the lowest power of each shared prime: 2 × 3 = 6.

Uses

GCF reduces fractions: 18/48 = 3/8 after dividing both by 6. It also gives the least common multiple: LCM(48, 18) = 48 × 18 ÷ 6 = 144. Inputs must be whole numbers up to 10¹².

What happens with invalid input

These messages are produced by the calculator itself, so you know what to fix.

  • Numbers: entering "12" shows "Enter at least 2 numbers." beside that field and no result.

Choosing between the GCF Calculator and similar calculators

Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.

Choosing between the GCF Calculator and similar calculators
CalculatorYou enterIt returns
[Slope Calculator](/math/slope-calculator/)x₁, y₁ and x₂Slope
[LCM Calculator](/math/lcm-calculator/)numbersLeast common multiple
[Factor Calculator](/math/factor-calculator/)numberFactors
[Quadratic Formula Calculator](/math/quadratic-formula-calculator/)a, b and cRoots
[Log Calculator](/math/log-calculator/)number x and base blog base 2 of 8

Background: algebra

Many algebra calculators rest on the same ideas: write the problem in a standard form, identify the coefficients, apply the formula and check the answer by substituting it back. For a quadratic ax² + bx + c = 0 the roots are (−b ± √(b² − 4ac)) ÷ 2a, and the discriminant b² − 4ac decides the kind of roots: positive gives two real roots, zero gives one repeated root and negative gives two complex conjugate roots.

If a = 0 the equation is linear, not quadratic. A sign slip on the −b term shifts both roots by the same amount, so substitute your roots back to check.

Assumptions and limitations

  • Needs at least two numbers
  • Positive whole numbers up to 10^12

If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for numbers to confirm this.

Frequently asked questions

What is the GCF of two primes?

1, since they share no factor.

Is GCF the same as GCD?

Yes, greatest common divisor.

Can I use three numbers?

Yes: gcd(a, b, c) = gcd(gcd(a, b), c).

What does the GCF Calculator calculate?

Greatest common factor (greatest common divisor) of two or more numbers. It returns Greatest common factor.

What formula does the GCF Calculator use?

gcd(a, b) = gcd(b, a mod b); gcd(a, b, c) = gcd(gcd(a, b), c). The Euclidean algorithm applied pairwise across the list.

What do I need to enter in the gCF Calculator?

You enter Numbers.

How is the result rounded or limited?

IEEE-754 double precision; shown to at most 6 decimal places. Needs at least two numbers.

What are the limits of this calculator?

Needs at least two numbers. Positive whole numbers up to 10^12.

What is an example of a gCF result?

With numbers 48, 18, the greatest common factor is 6.

Sources

  • OpenStax, Algebra and Trigonometry 2e (Rice University): exponents, radicals, logarithms and inverse trigonometric functions

Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.