Greatest Common Factor Calculator
Enter two whole numbers to find their greatest common factor (GCF), also called the greatest common divisor (GCD). The result also shows their least common multiple (LCM).
How it works
Divide the larger absolute number by the smaller and replace the pair with the smaller number and the remainder. Repeat until the remainder is zero; the last nonzero number is the greatest common factor. For nonzero inputs, divide one input by the GCF, multiply by the other, and take the absolute value to get the least common multiple.
Worked example
For 12 and 18, 18 ÷ 12 leaves 6 and 12 ÷ 6 leaves 0. The GCF is 6 and the LCM is 36.
Keep in mind
Inputs must be safe whole numbers and cannot both be zero. A nonzero integer and zero have a GCF equal to the nonzero absolute value and an LCM of zero.
What if one number is zero?
The GCF of 12 and 0 is 12, because 12 is the largest positive integer dividing both. Their LCM is 0. The GCF of 0 and 0 is undefined, so that pair is rejected.
Can I enter negative integers?
Yes. The GCF and LCM are reported as nonnegative values using the absolute values of the entered integers. For example, −12 and 18 have a GCF of 6 and an LCM of 36.