GCD & LCM Calculator
Find the Greatest Common Divisor (GCD / HCF) and Least Common Multiple (LCM) with step-by-step explanations, visuals, and examples.
Inputs
Results
Summary
What is GCD (HCF)?
The Greatest Common Divisor (GCD) — also called the Highest Common Factor (HCF) — is the largest number that divides two or more numbers without leaving a remainder.
- Simplifying fractions (e.g., 12/18 → 2/3)
- Reducing ratios (e.g., 20:30 → 2:3)
- Dividing items equally into groups
- Finding common factors in algebra
What is LCM?
The Least Common Multiple (LCM) is the smallest positive number that is a multiple of two or more numbers.
- Adding or subtracting fractions
- Synchronizing cycles or schedules
- Time & work problems
- Finding a common denominator
Difference between GCD and LCM
| Feature | GCD (HCF) | LCM |
|---|---|---|
| Meaning | Greatest common divisor | Least common multiple |
| Purpose | Simplification | Alignment |
| Common use | Reducing fractions, ratios | Adding fractions, schedules |
| Result size | Usually smaller | Usually larger |
| Example (12, 18) | 6 | 36 |
How this calculator works
This calculator lets you:
- Enter 2 or more numbers
- Instantly compute GCD (HCF) and LCM
- View step-by-step calculations (Advanced mode)
- Understand results using prime factor visuals (Quick mode)
- Euclidean Algorithm (fast and reliable)
- Prime Factorization (educational visuals)
- LCM identity: LCM(a, b) = |a × b| ÷ GCD(a, b)
Learn with Advanced mode
Advanced mode is designed to help you understand the “why,” not just the final answer.
- Euclidean algorithm steps (for GCD)
- LCM steps derived using GCD
- Prime factor breakdown and chips
- Visual separation of common vs max prime powers
Students, teachers, and anyone preparing for exams or interviews who wants clear reasoning and repeatable steps.
Visual explanation of GCD and LCM
To make the concepts easier to grasp, this page shows prime-factor “chips” for each number (when factorization is feasible), and highlights the exact prime powers that form the final answer.
Highlights show common prime powers (minimum exponent across all non-zero inputs).
Highlights show max prime powers (maximum exponent across inputs). If any input is 0, the LCM is 0.
Common mistakes
- Assuming LCM is always a × b (only true when the numbers are coprime)
- Forgetting to simplify fractions using the GCD
- Confusing when to use GCD vs LCM
- Ignoring special cases like 0 or negative numbers (this calculator handles them correctly)
Examples to try
Tip: paste any of these into the input box above.
Related calculators
- Fraction Calculator — simplify and add fractions using GCD & LCM.
- Percentage Calculator — learn percentage change and comparisons.
Frequently asked questions
Is GCD the same as HCF?▼
Can GCD be negative?▼
What is the LCM of 0 and a number?▼
Can I calculate GCD and LCM for more than two numbers?▼
Which method is best for GCD?▼
Ready to calculate?
Enter your numbers above to get GCD & LCM instantly — or switch to Advanced mode to learn step by step.