Math

GCF Calculator

Find the greatest common factor of two numbers.


GCF Calculator

Advertisement

The largest whole number that divides evenly into two given numbers, found using the efficient Euclidean algorithm.

How it works

Repeatedly replacing the larger number with the remainder of dividing it by the smaller number, until the remainder is zero — the last nonzero remainder is the greatest common factor.

What this does not include

This does not include the least common multiple — for both together, use this site’s GCF and LCM calculator instead.

How to use this calculator

  1. Enter both whole numbers.

A worked example

48 and 18: 48 ÷ 18 leaves remainder 12; 18 ÷ 12 leaves remainder 6; 12 ÷ 6 leaves remainder 0 — the last nonzero remainder, 6, is the GCF.

21 and 6: 21 ÷ 6 leaves remainder 3; 6 ÷ 3 leaves remainder 0 — GCF is 3.

What the algorithm does

Step What happens
Divide Larger number ÷ smaller number, keep the remainder
Replace The larger number becomes the smaller number; the smaller becomes the remainder
Repeat Until the remainder is 0 — the previous remainder is the GCF

Edge cases worth knowing

Two coprime numbers — sharing no common factor but 1 — have a GCF of exactly 1, a valid and common result, not a sign anything went wrong.

The Euclidean algorithm finishes in a handful of steps even for very large numbers, far faster than listing every factor of each number and comparing them.

Frequently asked questions

What does “greatest common factor” mean?

The largest number that divides evenly into both of the given numbers with no remainder — also called the greatest common divisor (GCD).

What if the two numbers share no common factor besides 1?

They’re called coprime, and the GCF is simply 1 — a completely valid, common result.

Why use the Euclidean algorithm instead of listing all factors?

It’s far faster for large numbers — listing every factor of a big number takes much longer than the handful of division steps the Euclidean algorithm needs.

Be the first to rate this

Written by

J. Adeyemi

Statistics writer

J. Adeyemi writes the statistics and probability calculators, from descriptive summaries through to distributions and conditional probability. The recurring theme is scope: each page states precisely which question it answers, because most statistical mistakes come from applying a correct formula to the wrong question. Related-but-different measures get separate pages rather than being quietly merged.

Reviewed by

T. Okafor

Calculator reviewer — mathematics

T. Okafor reviews the mathematics calculators, verifying algebraic correctness and, just as importantly, behaviour at the edges — division by zero, undefined results, and the floating-point cases where a formula technically returns a number that should be reported as undefined. Every test case is recomputed independently rather than taken on trust.

How we write and review

Related calculators