GCF and LCM calculator
Greatest common factor and least common multiple.
A GCF + LCM Calculator computes gcf + lcm from the inputs you provide. It applies the standard formula to the values you enter and returns the result instantly, without sending any data to a server. Free GCF + LCM Calculator.
Greatest common factor and least common multiple.
GCF: largest number dividing all. LCM: smallest multiple of all.
The greatest common factor (GCF) of a set of whole numbers is the largest number that divides all of them with no remainder. The least common multiple (LCM) is the smallest positive number that every one of them divides into. They are two of the most useful ideas in elementary number theory: the GCF answers "how large a shared piece can I break these into?" and the LCM answers "when do these cycles line up?". This calculator takes a comma-separated list and returns both, along with their product, for two or more values.
GCF is also called the greatest common divisor (GCD), the term used in mathematics and computing, while GCF is the label taught in school. For exactly two numbers the two quantities are tied together by a clean identity: the GCF multiplied by the LCM equals the product of the two numbers. That relationship is what lets the calculator compute the LCM cheaply once it has the GCF.
The tool finds the GCF with the Euclidean algorithm, one of the oldest algorithms still in use, then derives the LCM from it:
GCF(a, b): repeat a, b = b, a mod b until b = 0; GCF is a LCM(a, b) = |a x b| / GCF(a, b) For two numbers: GCF x LCM = a x b Many numbers: fold pairwise, e.g. GCF(a,b,c) = GCF(GCF(a,b), c)
Find the GCF and LCM of 12 and 18.
| Numbers | GCF | LCM | Note |
|---|---|---|---|
| 8 and 12 | 4 | 24 | Share factor 4 |
| 9 and 28 | 1 | 252 | Coprime, LCM = product |
| 6, 8 and 10 | 2 | 120 | Three numbers, pairwise |
| 15 and 25 | 5 | 75 | Share factor 5 |
| 7 and 21 | 7 | 21 | One divides the other |
The two operations show up together whenever you work with fractions. To reduce a fraction to lowest terms, divide the numerator and denominator by their GCF: 18/24 has a GCF of 6, so it simplifies to 3/4. To add or subtract fractions, you first need a common denominator, and the smallest one to use is the LCM of the denominators. Adding 1/6 and 1/8, the LCM of 6 and 8 is 24, so the sum becomes 4/24 + 3/24 = 7/24.
Cycle problems are the other classic use. If one bus comes every 6 minutes and another every 8 minutes, they next arrive together after LCM(6, 8) = 24 minutes. If you want to cut two ribbons of 12 cm and 18 cm into equal pieces with none left over, the longest each piece can be is GCF(12, 18) = 6 cm. Recognising which question you are asking, a shared piece (GCF) or a shared cycle (LCM), tells you which output to read.
The greatest common factor (GCF) is the largest number that divides evenly into all your values; the least common multiple (LCM) is the smallest number that all your values divide into. GCF is always less than or equal to the smallest input, and LCM is always greater than or equal to the largest input. For two numbers they are linked by GCF x LCM = a x b.
Yes. GCF (greatest common factor) and GCD (greatest common divisor) are two names for the same quantity. GCD is the term used in number theory and computer science; GCF is the term taught in most K-12 classrooms. Both refer to the largest integer that divides all the given numbers without a remainder.
It repeatedly replaces the larger number with the remainder of dividing the larger by the smaller, until the remainder is zero; the last non-zero value is the GCF. For example GCF(48, 18): 48 mod 18 = 12, then 18 mod 12 = 6, then 12 mod 6 = 0, so the GCF is 6. It is far faster than listing factors for large numbers.
Work in pairs. For the GCF, compute GCF(a, b), then take the GCF of that result with c, and so on: GCF(a, b, c) = GCF(GCF(a, b), c). The LCM works the same way: LCM(a, b, c) = LCM(LCM(a, b), c). This calculator accepts a comma-separated list and applies the pairwise rule automatically.
The GCF simplifies fractions to lowest terms (12/18 divides by GCF 6 to give 2/3). The LCM finds a common denominator for adding fractions and solves cycle-alignment problems, such as when two events that repeat every 6 and 8 days next coincide (LCM 24 days). Both appear in scheduling, gear ratios, music rhythm, and cryptography.