Skip to main content
ToolsHub

GCF and LCM Calculator

Enter two or more whole numbers to calculate their GCF and LCM, plus the prime factorization of each.

Updated

Files never leave your browser

Enter two or more positive whole numbers, separated by commas or spaces.

Results will appear here

Enter two or more numbers and press Calculate to find their GCF and LCM.

How to use GCF and LCM Calculator

The GCF and LCM calculator finds the greatest common factor and least common multiple of two or more whole numbers at once, and shows the prime factorization of each value so you can see how the results are built. Enter a list of numbers separated by commas or spaces and get the GCF (also called HCF), the LCM, and a factor breakdown — useful for simplifying fractions, finding common denominators, and scheduling problems.

  1. Enter two or more whole numbers, separated by commas or spaces.
  2. Press Calculate to compute the GCF and LCM.
  3. Read the GCF and LCM cards and each number’s prime factorization.
  4. Copy the summary to reuse the result elsewhere.

Your data never leaves your device — 100% private processing.

How the GCF and LCM are calculated

The greatest common factor is found with the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller until one becomes zero — the other is the GCF. For a list, the calculator folds this pairwise: GCF(a, b, c) = GCF(GCF(a, b), c). The least common multiple is derived from the GCF using LCM(a, b) = (a × b) ÷ GCF(a, b), again applied pairwise. This is exact and fast even for large numbers, unlike listing out every factor by hand.

Worked example for 12 and 18
StepValue
Prime factors of 122 × 2 × 3
Prime factors of 182 × 3 × 3
Shared factors (GCF)2 × 3 = 6
LCM = 12 × 18 ÷ 636

Where GCF and LCM show up

The GCF is the key to reducing fractions: 18/24 divides top and bottom by their GCF of 6 to give 3/4. The LCM is what you need for a least common denominator when adding fractions, and for timing problems — if one bus comes every 12 minutes and another every 18, the LCM of 36 tells you they arrive together every 36 minutes. Both ideas also appear in music (rhythmic cycles), engineering (gear ratios), and computer science (buffer and stride sizing), which makes a quick GCF/LCM tool broadly useful.

Worked examples

Two numbers

Inputs: 12, 18

Result: GCF 6 · LCM 36

Three numbers

Inputs: 4, 6, 8

Result: GCF 2 · LCM 24

Coprime pair

Inputs: 9, 16

Result: GCF 1 · LCM 144

Glossary

Greatest common factor (GCF)
The largest whole number that divides every number in a set without a remainder.
Least common multiple (LCM)
The smallest whole number that every number in a set divides into evenly.
Euclidean algorithm
An efficient method for the GCF that repeatedly takes remainders until one reaches zero.
Least common denominator
The LCM of the denominators of a set of fractions, used to add or compare them.

Related reading

Free · No spam

Get weekly tool tips & updates

New tools, power-user tips, and productivity hacks — delivered free every Friday.

No spam, ever. Unsubscribe with one click.

Related Calculators

Explore all Calculators.