Two or more numbers
Not limited to a pair — add as many whole numbers as you like and the GCF and LCM are computed across all of them.
Greatest common factor and least common multiple of two or more numbers — a GCF and LCM calculator in one page.
Loading tool…
The tool is loading its code on your device. This happens once and is cached for later visits.
Processed entirely on your device
Overview
Find the greatest common factor (GCF) and least common multiple (LCM) of two or more whole numbers, with the prime factorisation of each shown.
This GCF and LCM calculator finds the greatest common factor and least common multiple of any set of whole numbers. The greatest common factor and least common multiple are the two workhorses of fraction arithmetic. Enter any set of whole numbers and this calculator returns both, plus the prime factorisation of each input so you can see the shared factors directly.
GCF(12, 18) = 6 → the largest number dividing both
LCM(12, 18) = 36 → the smallest number both divide intoFor two numbers the identity GCF × LCM = a × b always holds — here 6 × 36 = 216 = 12 × 18.
The GCF uses Euclid's algorithm, repeatedly replacing the larger number by the remainder until one reaches zero. The LCM is then a × b ÷ GCF, extended across the whole list. Prime factorisation is shown for verification.
The GCF and LCM of 48 and 180, by Euclid's algorithm:
180 = 3 × 48 + 36
48 = 1 × 36 + 12
36 = 3 × 12 + 0 → remainder zero, so GCF = 12
LCM = (48 ÷ 12) × 180 = 4 × 180 = 720The identity GCF × LCM = a × b holds: 12 × 720 = 8,640 = 48 × 180. The prime factorisations agree as well — 48 = 2⁴ × 3 and 180 = 2² × 3² × 5, so the GCF takes the lowest power of each shared prime (2² × 3 = 12) and the LCM takes the highest (2⁴ × 3² × 5 = 720). Both routes reach the same pair, which is the check worth running when you are doing it on paper.
The obvious formula is a × b ÷ GCF and it is mathematically identical. The implementation computes (a ÷ GCF) × b instead, dividing first. The reason is overflow: for two large numbers the product a × b can exceed what a 64-bit integer holds even when the LCM itself fits comfortably inside it, and the division-first ordering never produces that intermediate value.
The same care runs through the rest of the tool. Everything is exact integer arithmetic, so there is no rounding anywhere and no practical upper limit. Euclid's algorithm is also remarkably quick — its step count grows with the logarithm of the input rather than with the input itself, which is why two fifteen-digit numbers resolve instantly instead of visibly grinding.
The LCM is the tool for adding fractions with unlike denominators: 1/6 + 1/8 needs a common denominator, and LCM(6, 8) = 24 is the smallest one that works. It also settles scheduling questions — two events repeating every 6 days and every 8 days coincide every 24 days.
The GCF is the tool for reducing fractions and for dividing things into equal groups. Twelve items and eighteen items can be split into groups of at most six with nothing left over, because GCF(12, 18) = 6. It is also the side length of the largest square that tiles a 12 × 18 rectangle exactly, and it is the basis of every simplification Fraction Calculator performs.
Both extend naturally beyond a pair: GCF(a, b, c) = GCF(GCF(a, b), c), and the LCM the same way, which is how this tool handles a whole list of inputs rather than only two. Ratio Calculator uses the identical GCF step to reduce a ratio to its lowest terms.
All of it runs in your browser with exact integer arithmetic. Nothing is uploaded.
Step by step
Enter two or more whole numbers, separated by commas or spaces.
Read the greatest common factor and the least common multiple.
Check the prime factorisation table to see where they come from.
Why use it
What this tool is good for, and what it deliberately does not try to do.
Not limited to a pair — add as many whole numbers as you like and the GCF and LCM are computed across all of them.
A table breaks each number into its prime factors, which makes the common factors and multiples easy to verify by hand.
Uses Euclid's algorithm, so even large numbers resolve instantly without rounding.
Questions
Short, honest answers about quality, limits and privacy.