GCF Calculator: Simple and Accurate

Enter numbers separated by commas to find their Greatest Common Factor (GCF) and Least Common Multiple (LCM):

How to Use:

  • Enter two or more positive integers separated by commas
  • Click "Calculate" to find both GCF and LCM
  • GCF is the largest number that divides all input numbers evenly
  • LCM is the smallest number that all input numbers divide into evenly

Worked example: 12, 18, 24

The tool uses the Euclidean algorithm, reducing the list pairwise. First it finds GCF(12, 18): 18 = 1×12 + 6, then 12 = 2×6 + 0, so GCF(12,18) = 6. Then it folds in the third number, GCF(6, 24): 24 is exactly divisible by 6, so the running GCF stays at 6. GCF(12, 18, 24) = 6.

For the LCM, it uses the identity LCM(a,b) = |a×b| / GCF(a,b), applied pairwise the same way: LCM(12,18) = (12×18)/6 = 216/6 = 36, then LCM(36,24) = (36×24)/GCF(36,24). Since GCF(36,24) = 12, that's 864/12 = 72.

Check: 72 ÷ 12 = 6, 72 ÷ 18 = 4, 72 ÷ 24 = 3 — all divide evenly, confirming 72 is the smallest common multiple.

Why GCF and LCM are related

For any two numbers, GCF × LCM always equals the product of the two numbers: GCF(12,18) × LCM(12,18) = 6 × 36 = 216 = 12 × 18. This identity is exactly what the calculator's LCM formula exploits — it never searches through multiples one by one, it just divides.

What breaks the calculation

The tool requires positive integers only. A single number, a decimal like 4.5, or a negative value all produce a validation error rather than a computed (and mathematically ambiguous) result — GCF and LCM are only conventionally defined for positive integers.