GCD and LCM Calculator
The greatest common divisor (GCD) is the largest number that divides both inputs, and the least common multiple (LCM) is the smallest number both divide into. For 48 and 18, GCD = 6 and LCM = 144.
Last updated · By S. Dilshan · Runs in your browser, nothing is uploaded
Step-by-Step Solution
What Are the GCD and LCM?
The greatest common divisor (GCD), also called the highest common factor (HCF) or greatest common factor (GCF), is the biggest whole number that divides two numbers exactly. The least common multiple (LCM) is the smallest positive number that is a multiple of both.
They are two sides of the same relationship, and they are essential for working with fractions: the GCD simplifies a fraction, and the LCM gives the common denominator needed to add fractions.
Quick Comparison
| GCD | LCM | |
|---|---|---|
| Meaning | Largest number that divides both | Smallest number both divide into |
| Also called | GCF, HCF | Lowest common multiple |
| Size | Never larger than the smaller number | Never smaller than the larger number |
| Used for | Simplifying fractions, splitting into equal groups | Common denominators, repeating cycles |
| For 48 and 18 | 6 | 144 |
How to Find the GCD and LCM
The GCD itself is found with Euclid’s algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last non-zero remainder is the GCD.
The alternative is the prime factor method. Write each number as a product of primes (the prime factorization calculator can help). The GCD takes the lowest power of each common prime, and the LCM takes the highest power of every prime that appears.
Worked Example: GCD and LCM of 48 and 18
Euclid’s Algorithm
- 48 = 2 × 18 + 12.
- 18 = 1 × 12 + 6.
- 12 = 2 × 6 + 0.
- The last non-zero remainder is 6, so GCD(48, 18) = 6.
Prime Factors
- 48 = 2⁴ × 3 and 18 = 2 × 3².
- GCD: lowest powers of the common primes: 2¹ × 3¹ = 6.
- LCM: highest powers of all primes: 2⁴ × 3² = 16 × 9 = 144.
Check
GCD × LCM = 6 × 144 = 864, and 48 × 18 = 864. ✓
Special Cases
| Numbers | GCD | LCM | Note |
|---|---|---|---|
| 12 and 20 | 4 | 60 | |
| 7 and 13 | 1 | 91 | Coprime (no common factor): LCM is the product |
| 8 and 24 | 8 | 24 | One divides the other: GCD is the smaller, LCM the larger |
Three or More Numbers
Apply the operation in pairs. GCD(12, 18, 30): GCD(12, 18) = 6, then GCD(6, 30) = 6. LCM(4, 6, 10): LCM(4, 6) = 12, then LCM(12, 10) = 60.
Fractions in Action
The GCD simplifies: 18/48 ÷ 6 gives 3/8. The LCM sets up addition: for 1/48 + 1/18, the common denominator is 144, so 3/144 + 8/144 = 11/144. Using the LCM rather than the product 48 × 18 = 864 keeps the numbers small.
How to Use This GCD and LCM Calculator
- Enter the first positive whole number.
- Enter the second positive whole number.
- Read the GCD and the LCM. The steps show Euclid’s algorithm.
To use the GCD to reduce a fraction, try the simplify fraction calculator, or use the LCM as a common denominator in the fraction calculator.
Where the GCD and LCM Are Used
- Fractions: simplify 18/48 by dividing both by 6 to get 3/8, and find common denominators using the LCM.
- Tiling and layout: the largest square tile that exactly covers a 48 × 18 floor has a side of 6.
- Scheduling: two buses that run every 48 and 18 minutes next leave together after 144 minutes, which is 2 hours 24 minutes.
- Grouping: dividing 48 boys and 18 girls into the largest identical teams gives 6 teams.
- Cryptography and computing: Euclid’s algorithm underlies modular arithmetic and RSA.
Equal Groups and Coprime Numbers
With 48 pencils and 18 erasers, the most identical kits you can make with nothing left over is GCD(48, 18) = 6 kits, each with 8 pencils and 3 erasers. Two numbers whose GCD is 1 are called coprime: 35 = 5 × 7 and 64 = 2⁶ share no prime factor, so GCD(35, 64) = 1 and LCM(35, 64) = 2,240.
What Are the Most Common Mistakes With the GCD and LCM Calculator?
- Mixing up GCD and LCM. The GCD is never bigger than the smaller input and the LCM is never smaller than the larger.
- Using decimals or negatives. The calculator is for positive whole numbers.
- Taking the product as the LCM. a × b is only the LCM when the numbers share no common factor.
- Missing common primes. When factoring, check that every shared prime is accounted for at its lowest power.
- Stopping Euclid’s algorithm too early. Continue until the remainder is exactly zero.
- Forgetting zero. GCD(a, 0) = a, but the LCM involving 0 is conventionally 0.
Where Can You Verify These Formulas?
The definitions and formulas on this page follow standard references. Check them against these sources:
Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.
Frequently Asked Questions
What is the GCD of 48 and 18?
6. It is the largest whole number that divides both 48 and 18 without a remainder.
What is the LCM of 48 and 18?
144. It is the smallest number that both 48 and 18 divide into exactly.
How do I find the LCM from the GCD?
LCM(a, b) = (a × b) ÷ GCD(a, b). For 48 and 18: 864 ÷ 6 = 144.
What is Euclid’s algorithm?
It repeatedly replaces the pair (a, b) by (b, a mod b) until the remainder is zero. The last non-zero value is the GCD.
What does it mean if the GCD is 1?
The numbers are coprime (relatively prime): they share no factors other than 1, and their LCM is simply their product.
What is the difference between GCD, GCF and HCF?
They are the same thing. Different regions and textbooks use greatest common divisor, greatest common factor or highest common factor.