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
- 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.