GCF & LCM Calculator
Find the Greatest Common Factor (GCF) and Least Common Multiple (LCM) of 2 or 3 numbers. Includes prime factorizations and full Euclidean algorithm steps.
Last updated: March 2026
How to Use the GCF & LCM Calculator
- Enter Number 1 and Number 2 — type any two positive whole numbers. Results appear immediately.
- Optionally add Number 3 — for a three-number calculation, fill in the third field and the GCF and LCM update automatically.
- Read the GCF — the primary display shows the Greatest Common Factor (largest number that divides all inputs evenly).
- Read the LCM — the first secondary row shows the Least Common Multiple (smallest positive multiple common to all inputs).
- Review the steps — prime factorizations and Euclidean algorithm divisions are listed so you can understand and replicate the work.
Understanding GCF and the Euclidean Algorithm
The Greatest Common Factor (also called Greatest Common Divisor, GCD, or Highest Common Factor, HCF) is the largest positive integer that divides two or more numbers without a remainder. For example, the factors of 48 are 1, 2, 3, 4, 6, 8, 12, 16, 24, 48. The factors of 18 are 1, 2, 3, 6, 9, 18. The common factors are 1, 2, 3, and 6. The greatest of these is 6, so GCF(48, 18) = 6.
The Euclidean algorithm is a far more efficient method than listing all factors, especially for large numbers. It is one of the oldest algorithms in mathematics, described by Euclid around 300 BCE. The algorithm exploits the property that GCF(a, b) = GCF(b, a mod b). By repeatedly replacing (a, b) with (b, a mod b), the numbers decrease rapidly until the remainder reaches 0, at which point the last non-zero remainder is the GCF.
Euclidean Algorithm Example: GCF(48, 18)
- 48 = 2 × 18 + 12 (remainder 12)
- 18 = 1 × 12 + 6 (remainder 6)
- 12 = 2 × 6 + 0 (remainder 0 — stop)
The last non-zero remainder is 6. Therefore GCF(48, 18) = 6.
Prime Factorization Method
An alternative approach: factor each number into primes, then multiply together the common prime factors raised to their lowest powers. For 48 = 2⁴ × 3 and 18 = 2 × 3²: the common primes are 2 and 3. Lowest powers: 2¹ and 3¹. So GCF = 2 × 3 = 6.
For the LCM, multiply together all prime factors at their highest powers: 2⁴ × 3² = 16 × 9 = 144. So LCM(48, 18) = 144.
LCM, Fractions, and Real-World Applications
The Least Common Multiple is the smallest positive integer that is a multiple of all the given numbers. For 4 and 6: multiples of 4 are 4, 8, 12, 16, 20... and multiples of 6 are 6, 12, 18... The first common value is 12, so LCM(4, 6) = 12. Using the GCF shortcut: LCM(4,6) = (4 × 6) / GCF(4,6) = 24 / 2 = 12.
Adding Fractions with Unlike Denominators
To add 1/4 + 1/6, find the least common denominator, which is LCM(4,6) = 12. Convert: 3/12 + 2/12 = 5/12. Without the LCM you could still add fractions using the product of denominators (24), but you'd get 10/24 which then needs to be simplified — more steps, same answer. The LCM gives the most efficient path.
Scheduling and Synchronisation Problems
LCM is the key to answering questions like: "Two buses leave a station, one every 8 minutes and one every 12 minutes. How many minutes before they both leave at the same time again?" LCM(8,12) = 24 minutes. Similarly, if you need to take medication A every 6 hours and medication B every 8 hours, they will coincide every LCM(6,8) = 24 hours.
The GCF × LCM Relationship
For any two positive integers a and b: GCF(a,b) × LCM(a,b) = a × b. This elegant relationship means you only need to compute one of them to derive the other. For a = 48 and b = 18: GCF = 6, LCM = (48 × 18) / 6 = 864 / 6 = 144. Check: 6 × 144 = 864 = 48 × 18. ✓
How to Find GCF and LCM If...
What is the GCF of 36 and 24?
GCF(36, 24) = 12. Euclidean: 36 = 1 × 24 + 12; 24 = 2 × 12 + 0. Last remainder = 12.
What is the LCM of 5 and 7?
LCM(5, 7) = 35. Since 5 and 7 are both prime and distinct, GCF = 1, so LCM = 5 × 7 / 1 = 35.
What is the GCF of three numbers: 12, 18, and 30?
GCF = 6. Step 1: GCF(12, 18) = 6. Step 2: GCF(6, 30) = 6. Final answer: 6.
What is the LCM of 3, 4, and 6?
LCM = 12. Step 1: LCM(3, 4) = 12. Step 2: LCM(12, 6) = 12. Final answer: 12.
What is the GCF of 100 and 75?
GCF = 25. 100 = 1 × 75 + 25; 75 = 3 × 25 + 0. GCF = 25.
Are two numbers coprime? GCF(14, 15) = ?
GCF(14, 15) = 1. 14 = 2 × 7 and 15 = 3 × 5 share no common prime factors, so GCF = 1. They are coprime (relatively prime).
What is the LCM used for in fraction addition?
The LCM gives the least common denominator (LCD). To add 5/12 + 7/18: LCM(12,18) = 36. Convert to 15/36 + 14/36 = 29/36.
What is the GCF of a number and itself?
GCF(n, n) = n. Any number divides itself exactly, and no larger number can be a common factor of n and n than n itself.
People Also Search For
How to find the GCF of large numbers quickly
Use the Euclidean algorithm — it is much faster than listing factors for large numbers. For GCF(1071, 462): 1071 = 2 × 462 + 147; 462 = 3 × 147 + 21; 147 = 7 × 21 + 0. GCF = 21. Only three steps regardless of how large the numbers are.
What is the difference between GCF, GCD, and HCF?
All three terms mean exactly the same thing. GCF = Greatest Common Factor (common in US elementary education), GCD = Greatest Common Divisor (used in algebra, number theory, and programming), HCF = Highest Common Factor (common in UK/Australian curricula).
How to simplify a fraction using GCF
Divide both the numerator and denominator by their GCF. To simplify 36/48: GCF(36,48) = 12. Divide: 36/12 = 3 and 48/12 = 4. Simplified fraction: 3/4.
How do you find LCM without prime factorization?
Use the GCF shortcut: LCM(a,b) = (a × b) / GCF(a,b). This is faster than listing multiples for large numbers. Compute GCF with the Euclidean algorithm, then divide the product by the GCF.
What is the GCF used for in real life?
GCF is used for splitting things into equal groups, simplifying fractions, and solving problems involving even distribution. Examples: dividing 24 apples and 36 oranges into equal groups of the same size (GCF = 12, so 12 groups of 2 apples and 3 oranges); simplifying ratio comparisons; cryptographic algorithms in computer science.
Frequently Asked Questions
What does GCF stand for?
GCF stands for Greatest Common Factor — the largest positive integer that divides two or more numbers without leaving a remainder. It is also called the GCD (Greatest Common Divisor) or HCF (Highest Common Factor).
What is the GCF of 48 and 18?
The GCF of 48 and 18 is 6. Euclidean steps: 48 ÷ 18 = 2 remainder 12; 18 ÷ 12 = 1 remainder 6; 12 ÷ 6 = 2 remainder 0. The last non-zero remainder is 6.
What is the LCM of 4 and 6?
The LCM of 4 and 6 is 12. GCF(4,6) = 2, so LCM = (4 × 6) / 2 = 24 / 2 = 12. You can verify: 12 is divisible by both 4 and 6, and no smaller positive number is divisible by both.
Why is the Euclidean algorithm so efficient?
The Euclidean algorithm reduces the problem size rapidly. At each step the pair of numbers decreases by at least half every two steps, meaning it takes at most 2 × log₂(smaller number) steps — far fewer than testing every possible divisor.
What is the GCF of a number and 1?
GCF(n, 1) = 1 for any positive integer n. The only divisor of 1 is 1 itself, so 1 is always the greatest common factor when 1 is one of the inputs.
How do I use LCM to add fractions?
Find the LCM of the denominators (called the LCD). Convert each fraction to an equivalent fraction with the LCD as denominator, then add the numerators. Example: 1/6 + 1/4 → LCD = LCM(6,4) = 12 → 2/12 + 3/12 = 5/12.
Can the GCF be larger than either number?
No. The GCF of two numbers can never exceed the smaller of the two numbers, because a factor of n must be ≤ n. The maximum is reached when one number is a multiple of the other, in which case GCF equals the smaller number.
What does it mean if GCF = 1?
If GCF(a,b) = 1, the numbers are called coprime or relatively prime. They share no common prime factors. Examples: 8 and 9, 14 and 15, any two consecutive integers.
Does this calculator work for three numbers?
Yes. Fill in the optional Number 3 field and the calculator will compute GCF and LCM for all three numbers by chaining the two-number algorithm: GCF(a,b,c) = GCF(GCF(a,b), c).
Is my data stored or sent to a server?
No. All calculations run entirely in your browser. No numbers are transmitted to any server and nothing is stored after you leave the page.