LCM & HCF/GCF Calculator

Least common multiple and greatest common factor for 2 to 10 numbers by prime factors, division ladder or Euclid, plus a divisibility check.

Every factorization and remainder chain is computed locally in your browser. Nothing ever leaves your device.

GCF (greatest common factor)
—
LCM (least common multiple)
—

How It Works

All three tabs compute the same answers with different machinery, and the Steps panel reruns the chosen method on your own numbers every time you type. For a preview, take 12 and 18: 12 = 2²×3 and 18 = 2×3². The GCF takes each prime to its lowest power (2¹×3¹ = 6), the LCM takes each prime to its highest (2²×3² = 36), and Euclid reaches 6 by remainders: 18 = 1×12 + 6, then 12 = 2×6 + 0. Different routes, one answer each.

The factor min/max principle
Common divisors can only use primes that appear in every number, and only up to the smallest exponent — so GCF = product of minimum powers. Common multiples must contain every prime from every number at least up to the largest exponent — so LCM = product of maximum powers. With 12 and 18 that is min(2,1) = 1 for the 2s, min(1,2) = 1 for the 3s, and the maxes 2 and 2. This generalizes to any count of inputs.
Euclid, with remainders instead of factoring
gcd(a, b) = gcd(b, a mod b): any number dividing both a and b also divides their difference-and-remainder, so the pair shrinks without losing common divisors. For 12 and 18 the chain 18, 12 → 12, 6 → 6, 0 stops at 6. For more than two numbers the tool chains the pairs, and gcd(0, n) = n makes chains start cleanly even with zeros.
Why LCM is verified by division
After computing, the panel checks LCM ÷ each input leaves remainder 0 — the defining property of a common multiple — and the smallest such positive number is what the maximum-exponent construction guarantees. If the inputs include 0, the verification prints the convention note instead, because 0 is technically a multiple of every integer.

Frequently Asked Questions

How do I tell LCM and GCF word problems apart?

Look at the shape of the grouping. Splitting things into the largest equal piles — 'maximum number of students', 'greatest possible tile size' — is a GCF problem because the answer must divide what you have. Waiting for events to line up again — 'when will both buses leave together', 'next time the gears align' — is an LCM problem because the answer must be a multiple of each cycle. If the answer is bigger than every input, it is LCM; if smaller, GCF.

Can this calculator find the LCM of fractions?

Not the fraction LCM itself — that is a different formula (LCM of numerators over GCF of denominators) and lives in fraction tooling. Here, inputs are whole numbers only. Use fraction-calculator for fraction arithmetic, and come back with the denominators if you need a common one.

What happens with zero or negative inputs?

Negatives are handled by the standard absolute-value convention: GCF(-12, 18) = 6, and results are always reported positive. Zero is legal for the GCF — every number divides 0, so GCF(0, n) = n — but the LCM of any set containing 0 is 0, because 0 is a multiple of everything. The calculator states which convention it applied instead of silently redefining your inputs.

Why does a × b = GCF × LCM only appear for two numbers?

Because the identity is genuinely pairwise: it compares the per-prime min and max exponents of two factorizations, and for those the product of min and max equals the sum of the exponents. With three numbers, min × max no longer recovers all three — for 12, 18 and 30 the product is 6480 while GCF × LCM = 6 × 180 = 1080. The tool shows the check when you enter exactly two numbers and stays quiet otherwise.

Is anything uploaded to a server?

No. Factorizations, ladders, Euclidean chains and the verification lines all run in your browser with plain JavaScript. Nothing leaves your device, and there is no account or network request attached to a calculation.