Math / calculator

GCF Calculator (Greatest Common Factor)

Calculate the exact greatest common factor or divisor of signed integers, including zeros and multiple inputs.

Calculator

Calculator

Find the greatest common factor.

Use 2–100 signed integers of up to 30 digits each. GCF (GCD) uses the Euclidean algorithm and is always nonnegative; GCF(0,0) is reported as 0 by convention.

Integer list

Your result

Enter details to see the result.

Complete the inputs and calculate to see the main result and its supporting breakdown.

Example

Worked example

Example inputs

Integers
48, 18

Calculation breakdown

Euclidean algorithm: repeatedly replace (a,b) with (b,a mod b) until b=0, after taking absolute values. For 48 and 18: 48 mod 18 = 12, 18 mod 12 = 6, and 12 mod 6 = 0, so the GCF is 6. Dividing both terms by 6 reduces 48/18 to 8/3. For more than two integers, repeat with the running GCF and the next integer.

Example result

Greatest common factor

6

Exact nonnegative integer; also called greatest common divisor.

How to interpret the result

The nonnegative exact result divides every input integer without a remainder. Negative signs are ignored. Zero paired with a nonzero value returns that magnitude; an all-zero list returns the conventional zero.

How to use this calculator

  1. Enter two or more integer values separated by commas or whitespace.
  2. Include negatives or zeros if needed, within the 100-value and 30-digit limits.
  3. Calculate the greatest common factor; read the exact nonnegative GCD result.

How it works

Formula

Euclidean algorithm: repeatedly replace (a,b) with (b,a mod b) until b=0, after taking absolute values. For 48 and 18: 48 mod 18 = 12, 18 mod 12 = 6, and 12 mod 6 = 0, so the GCF is 6. Dividing both terms by 6 reduces 48/18 to 8/3. For more than two integers, repeat with the running GCF and the next integer.

Are GCF and GCD different?

No. Greatest common factor and greatest common divisor describe the same nonnegative integer result. GCF(48,18)=6.

What this calculator does

Find the largest factor shared by your integers before reducing a ratio or simplifying a fraction.

Inputs you will need

Required or selected inputs

  • Integers

Assumptions

  • GCF and GCD name the same calculation. The result is nonnegative; GCF(0,0)=0 is the implemented convention.

Limitations

  • Use 2–100 integers, at most 30 digits each, within 4,000 characters. All-zero lists report the conventional 0 rather than a greatest positive divisor.

Useful next steps

For a shared multiple rather than a shared divisor, choose LCM Calculator.

See how HandyChest handles units, validation, rounding, and testing, or Report a problem with this calculator.

Good to know

Frequently asked questions

What is the GCF of zero and a nonzero integer?

It is the absolute value of the nonzero integer. Every integer divides zero; an all-zero list uses the conventional result zero.

Keep going