Skip to main content
MathKit

GCF Calculator

Compute the greatest common factor (greatest common divisor) of two integers.

Calculator

Use the GCF Calculator

Result

—

Formula

gcf(A, B)

Step-by-step

  1. 1

    Enter integers

    Provide the two integer values.

  2. 2

    Apply Euclidean algorithm

    Repeatedly reduce until remainder is zero.

Worked example

Example input: a: 12, b: 18

Result: 6

Related tools

Frequently asked questions

What is the greatest common factor of 12 and 18?

6. Both 12 and 18 divide evenly by 6, and no larger number does: 12 = 6 × 2 and 18 = 6 × 3.

How is the GCF found behind the scenes?

The calculator uses the Euclidean algorithm: divide the larger number by the smaller, repeat with the divisor and remainder until the remainder hits 0, and the last non-zero value is the GCF.

Can the inputs be negative?

Yes — common factors ignore the sign, so the calculator works with the absolute values and always returns a positive GCF. Decimals are truncated to whole numbers first.

What is the GCF of two consecutive integers?

Always 1. Two numbers that differ by 1 share no common divisor except 1, so their greatest common factor is 1. Try 14 and 15 in the calculator and you will see the result immediately.

What is the GCF of 24 and 36?

12. The shared factors of 24 and 36 are 1, 2, 3, 4, 6 and 12, and 12 is the largest — so 24 = 12 × 2 and 36 = 12 × 3.

How do you find the GCF using prime factorization?

Factor both numbers into primes, then multiply only the shared primes at their lowest power: 24 = 2³ × 3 and 36 = 2² × 3² share 2² and 3¹, so the GCF is 2² × 3 = 12. The Euclidean algorithm gives the same answer with less writing.

Useful links