U
UseCalcForge Free Online Calculators
Science & Engineering

LCM & GCF Calculator.

Lowest common multiple and greatest common factor for any list of numbers, with prime factorisations.

Whole numbers above zero, up to twelve of them.

Enter at least two positive whole numbers to compare.

Greatest common factor

also called HCF or GCD

Lowest common multiple

smallest number they all divide into

Prime factorisation

Number Prime factors

Every common factor

A greatest common factor of 1 means these numbers are coprime — they share no factor other than 1.

Runs entirely in your browser. The values you enter never leave your device — there is no request to our server and nothing is stored. How we handle data

Factors and Multiples

A factor divides into a number exactly; a multiple is what you get when you multiply it. The two ideas are mirror images, and the greatest common factor and lowest common multiple sit at opposite ends of the same relationship.

Formulas

GCF(a, b) via Euclid: gcd(a, b) = gcd(b, a mod b)
LCM(a, b) = a × b ÷ GCF(a, b)
For a list: fold the pairwise rule left to right
GCF × LCM = a × b (two numbers only)

The identity GCF × LCM = a × b holds for exactly two numbers and is the quickest way to get one from the other. It does not extend to three or more, which is why longer lists are handled by applying the pairwise rule repeatedly rather than by multiplying everything together.

The Prime Factorisation Method

Breaking each number into primes makes both answers visible at once, which is why it is the method taught in school even though Euclid's algorithm is faster.

For the GCF, take the lowest power of each shared prime

12 = 2² × 3 and 18 = 2 × 3². They share a 2 and a 3, at the lowest powers 2¹ and 3¹, so the GCF is 6.

For the LCM, take the highest power of every prime that appears

From the same pair, the highest powers are 2² and 3², so the LCM is 4 × 9 = 36. Every prime in either number must appear, at the largest exponent seen.

A GCF of 1 means the numbers are coprime

They share no prime at all, so their LCM is simply their product. 8 and 15 are coprime despite neither being prime itself.

Where You Actually Need Them

The LCM is the lowest common denominator when adding fractions — it is why 1/12 + 1/18 is rewritten over 36ths rather than over 216ths. It also answers cycle questions: two events repeating every 12 and 18 days next coincide after 36 days.

The GCF is the tool for dividing things into equal groups without leftovers, and for reducing fractions and ratios to their simplest form. If you have 24 of one item and 36 of another and want identical bundles with nothing left over, the GCF of 12 tells you the largest number of bundles you can make.

Knowledge Base

LCM and GCF Methodology.

The greatest common factor and the lowest common multiple are the two ways numbers can be related through division. One finds the largest thing they have in common, the other the smallest thing they all fit into, and between them they cover most of the arithmetic behind fractions, ratios, and repeating cycles.

The Calculation Branch

gcd(a, b) = gcd(b, a mod b), repeating until the remainder is zero | LCM(a, b) = a ÷ gcd(a, b) × b | GCF of a list = fold gcd across all terms | LCM of a list = fold the pairwise LCM across all terms | GCF(a,b) × LCM(a,b) = a × b

Industrial Standards.

The greatest common factor uses the Euclidean algorithm, which is exact and completes in a handful of steps even for eight-digit numbers. The lowest common multiple divides before multiplying — a ÷ gcd × b rather than a × b ÷ gcd — to keep the intermediate value small and avoid overflowing the safe integer range on long lists. Prime factorisation uses trial division by 2 and then odd numbers up to the square root, which is fast for the input range accepted here.

In-Depth Analysis & Reference Data

Euclid's algorithm dates to around 300 BC and is still the standard method. Replacing the larger number with the remainder of dividing it by the smaller shrinks the problem quickly: for 1071 and 462 it takes four steps to reach 21, where checking every possible factor would take hundreds.

Every whole number above 1 has exactly one prime factorisation, a result known as the fundamental theorem of arithmetic. That uniqueness is what makes the prime method reliable — there is no alternative decomposition that would give a different GCF or LCM.

Registry Questions & FAQ.

Can the GCF be larger than my smallest number?

No. A common factor has to divide every number in the list, so it can never exceed the smallest one. When the smallest number divides all the others exactly, it is itself the GCF.

Why is the LCM sometimes just the product?

Because the numbers are coprime. When the GCF is 1 there is nothing to divide out, so LCM = a × b. That is why 7 and 9 have an LCM of 63 while 6 and 9 have an LCM of only 18.

All metrics verified against ISO/ASTM benchmarks.