LCM and GCF Calculator

Find the Least Common Multiple (LCM) and Greatest Common Factor (GCF/GCD) of up to 6 numbers with step-by-step working.

🔢 LCM and GCF Calculator
Enter Numbers (2 to 6, comma or space separated)

Enter positive integers only. Example: 12, 18, 24  ·  100 75  ·  360 420 630

LCM
GCF / GCD / HCF

Prime Factorization

Step-by-Step Working (Euclidean Algorithm for GCF)

🔢 What are LCM and GCF?

The Greatest Common Factor (GCF) — also called the Greatest Common Divisor (GCD) or Highest Common Factor (HCF) — is the largest positive integer that divides all the given numbers without leaving a remainder. For example, the GCF of 12 and 18 is 6, because 6 is the largest number that divides both 12 and 18 exactly. GCF is fundamental to simplifying fractions and solving division problems.

The Least Common Multiple (LCM) is the smallest positive integer that is divisible by all the given numbers. For example, the LCM of 12 and 18 is 36, because 36 is the smallest number that appears in the multiplication tables of both 12 and 18. LCM is essential for adding and subtracting fractions with different denominators (finding the Least Common Denominator) and solving problems involving repeating events.

The two are related by a beautiful formula: for any two positive integers a and b, LCM(a, b) × GCF(a, b) = a × b. This means once you know the GCF, you can find the LCM with simple arithmetic: LCM = (a × b) ÷ GCF. This calculator uses this relationship internally after computing the GCF via the efficient Euclidean algorithm.

Real-world applications: GCF is used when dividing things into equal groups (the greatest number of equal baskets you can fill), simplifying measurements, and reducing fractions. LCM is used in scheduling (when will two events next coincide?), music (finding common time signatures), and computer science (computing with clock cycles and buffer sizes).

For more than two numbers, GCF is computed iteratively: GCF(a, b, c) = GCF(GCF(a, b), c). Similarly, LCM(a, b, c) = LCM(LCM(a, b), c). This calculator handles up to 6 numbers automatically.

📐 LCM and GCF Formulas

GCF(a, b): Euclidean Algorithm
Step 1: Divide the larger by the smaller: larger = (quotient × smaller) + remainder
Step 2: Replace larger with smaller, smaller with remainder. Repeat.
Step 3: When remainder = 0, the last non-zero remainder is the GCF.
Example: GCF(48, 18) → 48 = 2×18+12 → 18 = 1×12+6 → 12 = 2×6+0 → GCF = 6
LCM(a, b) = |a × b| ÷ GCF(a, b)
Example: LCM(12, 18) = (12 × 18) ÷ GCF(12, 18) = 216 ÷ 6 = 36
Prime Factorization Method
GCF: Multiply all primes common to every number, using the lowest power of each.
LCM: Multiply all primes appearing in any number, using the highest power of each.
12 = 2² × 3  ·  18 = 2 × 3²  →  GCF = 2¹ × 3¹ = 6  ·  LCM = 2² × 3² = 36

📖 How to Use This Calculator

Examples of valid inputs

1
Two numbers: Type 12, 18 or 12 18 — both formats work.
2
Three numbers: 8, 12, 20 or 8 12 20
3
Up to 6 numbers: 4, 6, 8, 10, 12, 15

💡 Example Calculations

Example 1 — Adding Fractions (LCD)

Find LCM(8, 12) to add 3/8 + 5/12

1
GCF(8, 12): 8 = 2³, 12 = 2² × 3 → GCF = 2² = 4
2
LCM = (8 × 12) ÷ 4 = 96 ÷ 4 = 24
3
3/8 = 9/24  ·  5/12 = 10/24  ·  Sum = 19/24
LCM(8, 12) = 24 (the LCD). 3/8 + 5/12 = 9/24 + 10/24 = 19/24
Try this example →

Example 2 — Three Numbers

GCF and LCM of 24, 36, 48

1
24 = 2³ × 3  ·  36 = 2² × 3²  ·  48 = 2&sup4; × 3
2
GCF = lowest powers of common primes = 2² × 3 = 4 × 3 = 12
3
LCM = highest powers of all primes = 2&sup4; × 3² = 16 × 9 = 144
GCF(24, 36, 48) = 12  ·  LCM(24, 36, 48) = 144
Try this example →

❓ Frequently Asked Questions

What is the difference between LCM and GCF?+
GCF (Greatest Common Factor) is the largest number that divides all the given numbers without a remainder. LCM (Least Common Multiple) is the smallest number that is a multiple of all the given numbers. For 12 and 18: GCF = 6 (largest number dividing both), LCM = 36 (smallest number that is a multiple of both). The relationship is: LCM × GCF = product of the two numbers (for two numbers).
How do you find the GCF of two numbers?+
The most efficient method is the Euclidean Algorithm: divide the larger number by the smaller, take the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCF. Example: GCF(48, 18) — 48 ÷ 18 = 2 remainder 12 → 18 ÷ 12 = 1 remainder 6 → 12 ÷ 6 = 2 remainder 0. GCF = 6. Alternatively, list all factors of both numbers and identify the greatest one they share.
How do you find the LCM of two numbers?+
Three methods: (1) Using GCF: LCM(a,b) = |a × b| ÷ GCF(a,b). Example: LCM(12,18) = 12×18 ÷ 6 = 216 ÷ 6 = 36. (2) Prime factorization: find prime factors of each number, take each prime to its highest power across both numbers. 12 = 2² × 3, 18 = 2 × 3². LCM = 2² × 3² = 36. (3) Listing multiples: list multiples of each and find the first common one (inefficient for large numbers).
What is prime factorization?+
Prime factorization is expressing a number as the product of its prime factors. A prime number is one divisible only by 1 and itself. For example: 60 = 2 × 2 × 3 × 5 = 2² × 3 × 5. To find it, divide repeatedly by the smallest prime that divides the number: 60 ÷ 2 = 30, 30 ÷ 2 = 15, 15 ÷ 3 = 5, 5 ÷ 5 = 1. Primes used: 2, 2, 3, 5 → 60 = 2² × 3¹ × 5¹.
What is GCF used for in real life?+
GCF is used to simplify fractions (divide numerator and denominator by their GCF), distribute items into equal groups (e.g., arranging 24 apples and 36 oranges into the greatest number of identical baskets without leftovers = GCF(24,36) = 12 baskets), and solving problems involving tiling, dividing resources, or scheduling.
What is LCM used for in real life?+
LCM is used to add or subtract fractions (find the Least Common Denominator), schedule repeating events (e.g., if bus A runs every 12 minutes and bus B every 18 minutes, both depart together again every LCM(12,18) = 36 minutes), and solve problems involving repeating cycles, gear ratios, and tiling patterns.
What is the GCF of two consecutive numbers?+
The GCF of any two consecutive integers is always 1. For example, GCF(7, 8) = 1, GCF(100, 101) = 1. Consecutive integers share no common factors other than 1 — this is why consecutive integers are called coprime. As a consequence, LCM of two consecutive integers n and (n+1) = n × (n+1), since GCF = 1.
What is the difference between GCF and HCF?+
GCF (Greatest Common Factor) and HCF (Highest Common Factor) are exactly the same thing — different names for the same mathematical concept. In the US, ‘GCF’ is more common; in India and the UK, ‘HCF’ is widely used. GCD (Greatest Common Divisor) is the third name for the same concept, common in computer science and algebra. This calculator uses GCF but the result is identical regardless of which term you use.
How do you find the LCM and GCF of three or more numbers?+
Use the iterative method: compute the GCF (or LCM) of the first two numbers, then compute GCF (or LCM) of that result with the third number, and so on. For GCF(12, 18, 24): GCF(12, 18) = 6, then GCF(6, 24) = 6. For LCM(4, 6, 10): LCM(4, 6) = 12, then LCM(12, 10) = 60. This calculator supports up to 6 numbers using this iterative approach.
Can the LCM be smaller than the largest number?+
No. The LCM is always greater than or equal to the largest of the given numbers. If one number is a multiple of the others, the LCM equals the largest number. For example, LCM(4, 8, 16) = 16 (since 4 and 8 both divide 16 evenly). The LCM can never be smaller than the largest input because the largest input itself must divide the LCM.