LCM and GCF Calculator with Steps

Find the least common multiple and greatest common factor, also called GCD or HCF, for two or more integers. Choose a method to show the work, including Euclidean algorithm, prime factorization, factor lists, ladder method, or the LCM using GCF formula.

Inputs & Options

Paste numbers separated by spaces, new lines, semicolons, or commas. Thousands separators such as 2,500 are supported safely; use a space or new line between list entries when a comma could be ambiguous.

Show work by

LCM is reported as non-negative. If any input exceeds 9,007,199,254,740,991 (253−1), the calculator switches to BigInt mode automatically.

Results

Enter two or more integers, choose a method, then calculate.

Advertisement

Worked Examples

LCM and GCF of 12, 18, and 30

Prime factors: 12 = 22 x 3, 18 = 2 x 32, 30 = 2 x 3 x 5.

GCF takes the shared lowest powers: 2 x 3 = 6.

LCM takes the highest powers: 22 x 32 x 5 = 180.

GCF of 8, 12, and 20

Factors of 8: 1, 2, 4, 8. Factors of 12: 1, 2, 3, 4, 6, 12. Factors of 20: 1, 2, 4, 5, 10, 20.

Common factors are 1, 2, and 4, so the GCF is 4.

LCM of 18 and 24

18 = 2 x 32 and 24 = 23 x 3.

Use the highest powers: 23 x 32 = 8 x 9 = 72.

Zero and negative example: -12, 0, 18

With absolute values, the list becomes 12, 0, 18.

GCF(12, 0, 18) = 6. Because one input is 0, the LCM of the list is 0.

Definitions, Formulas, and Methods

The LCM (least common multiple) is the smallest non-negative number that all non-zero inputs divide into evenly. The GCF (greatest common factor), also called GCD or HCF, is the largest number that divides every input without a remainder.

For two non-zero integers, the standard relationship is \( \mathrm{LCM}(a,b)=\dfrac{|a\cdot b|}{\gcd(a,b)} \). For three or more numbers, both LCM and GCF are computed by reducing the list pairwise.

Prime factor rules

Factor each number into primes. GCF uses the shared primes at their lowest powers. LCM uses every prime that appears at its highest power.

Ladder or cake method

Divide all possible numbers by shared prime factors, then continue with primes that divide at least one remaining number. Shared divisors help form the GCF, and all divisors and leftovers form the LCM.

Euclidean algorithm

Repeatedly divide and keep the remainder: \(a = bq + r\). When the remainder is 0, the last non-zero divisor is the GCF.

Common mistakes

Do not split a thousands-formatted number like 2,500 into 2 and 500. Do not use common factors for LCM unless you also include the remaining prime powers. Remember that any zero input makes the LCM 0.

Last updated: June 30, 2026.
Calculation note: Results use integer arithmetic, absolute values when selected, the Euclidean algorithm for GCF/GCD/HCF, and the identity \( \mathrm{LCM}(a,b)=|ab|/\gcd(a,b) \) for non-zero pairs.
Editorial note: This page was prepared for educational calculator use and checked against standard number theory definitions for LCM, GCF/GCD/HCF, prime factorization, and zero cases.

Frequently Asked Questions

What is the LCM of 18 and 24?

The LCM of 18 and 24 is 72. Since 18 = 2 x 3^2 and 24 = 2^3 x 3, take the highest powers of each prime: 2^3 x 3^2 = 72.

What is the GCF of 8 and 12?

The GCF of 8 and 12 is 4. The factors of 8 are 1, 2, 4, 8 and the factors of 12 are 1, 2, 3, 4, 6, 12, so the greatest common factor is 4.

How do you find LCM using GCF?

For two non-zero integers, use LCM(a,b) = |a x b| / GCF(a,b). For more than two numbers, apply the formula pairwise from left to right.

Are GCF and GCD the same?

Yes. GCF means greatest common factor and GCD means greatest common divisor. HCF, highest common factor, is another name for the same value.

What happens if one number is 0?

For GCF, gcd(a,0)=|a|. For LCM, if any number in the list is 0, the LCM is 0 because no positive common multiple is required for a zero term.

How do you find LCM or GCF of more than two numbers?

Reduce the list pairwise. For example, GCF(12,18,30) = GCF(GCF(12,18),30), and LCM(12,18,30) = LCM(LCM(12,18),30).

Explore more tools